file_name
stringlengths 5
52
| name
stringlengths 4
95
| original_source_type
stringlengths 0
23k
| source_type
stringlengths 9
23k
| source_definition
stringlengths 9
57.9k
| source
dict | source_range
dict | file_context
stringlengths 0
721k
| dependencies
dict | opens_and_abbrevs
listlengths 2
94
| vconfig
dict | interleaved
bool 1
class | verbose_type
stringlengths 1
7.42k
| effect
stringclasses 118
values | effect_flags
sequencelengths 0
2
| mutual_with
sequencelengths 0
11
| ideal_premises
sequencelengths 0
236
| proof_features
sequencelengths 0
1
| is_simple_lemma
bool 2
classes | is_div
bool 2
classes | is_proof
bool 2
classes | is_simply_typed
bool 2
classes | is_type
bool 2
classes | partial_definition
stringlengths 5
3.99k
| completed_definiton
stringlengths 1
1.63M
| isa_cross_project_example
bool 1
class |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Vale.AES.X64.GCMdecryptOpt.fst | Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_blocks_wrapped | val va_code_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> Tot va_code | val va_code_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> Tot va_code | let va_code_Gcm_blocks_wrapped alg offset =
(va_Block (va_CCons (va_code_Gcm_blocks alg offset) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_Block (va_CNil ())) (va_CNil ()))))) | {
"file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 44,
"end_line": 1362,
"start_col": 0,
"start_line": 1360
} | module Vale.AES.X64.GCMdecryptOpt
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GCM
open Vale.AES.GHash_s
open Vale.AES.GHash
open Vale.AES.GCM_s
open Vale.AES.X64.AES
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.Poly1305.Math
open Vale.AES.GCM_helpers
open Vale.AES.X64.GHash
open Vale.AES.X64.GCTR
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsStack
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.X64.GF128_Mul
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2.Bits_s
open Vale.AES.X64.AESopt
open Vale.AES.X64.AESGCM
open Vale.AES.X64.AESopt2
open Vale.Lib.Meta
open Vale.AES.X64.GCMencryptOpt
open Vale.AES.OptPublic
open Vale.Lib.Basic
#reset-options "--z3rlimit 20 --max_ifuel 0"
//-- Gcm_extra_bytes
val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_extra_bytes alg =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0)
(va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor
(va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_CNil ()))))))))))
val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_extra_bytes alg =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and
(va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat)
(old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit
(va_code_Gcm_extra_bytes alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range
1 1)) = 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRax) 0 Secret inout_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let
(hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s)
inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key
round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax)
(va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (()))))))))))))))
val va_lemma_Gcm_extra_bytes : va_b0:va_code -> va_s0:va_state -> alg:algorithm ->
inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) ->
h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_extra_bytes alg) va_s0 /\ va_get_ok va_s0 /\ (let
(len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b
inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b
len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM
(va_update_mem va_sM va_s0))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_extra_bytes va_b0 va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes
old_hash completed_quads h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_extra_bytes va_mods alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_extra_bytes alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 121 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (len:(va_int_range 1 1)) = 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 177 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 181 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE old_hash input_quads)))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\
Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b
inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax
va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\ (forall
(va_x_mem:vale_heap) (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm10:quad32) (va_x_heap5:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 5
va_x_heap5 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7
(va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRcx va_x_rcx (va_upd_mem va_x_mem va_s0)))))))))))))) in va_get_ok
va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==> va_k va_sM (())))
val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat ->
old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags;
va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_extra_bytes (va_code_Gcm_extra_bytes alg) va_s0 alg inout_b key
round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10
va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_extra_bytes alg)) =
(va_QProc (va_code_Gcm_extra_bytes alg) ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem])
(va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE) (va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE))
//--
//-- Gcm_blocks128
val va_code_Gcm_blocks128 : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks128 alg =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_CCons
(va_code_Ghash_buffer ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi)
(va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdx)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Gctr_blocks128 alg) (va_CNil ())))))))))
val va_codegen_success_Gcm_blocks128 : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks128 alg =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Ghash_buffer ()) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Gctr_blocks128 alg) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks128 (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128)
(key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32)
: (va_quickCode unit (va_code_Gcm_blocks128 alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 274 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 275 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 277 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_buffer hkeys_b in_b h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_old_s))) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gctr_blocks128 alg in_b out_b key round_keys keys_b) (va_QEmpty (()))))))))))
val va_lemma_Gcm_blocks128 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 ->
out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks128 alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 10 va_sM (va_update_xmm 11 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR11 va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks128 va_b0 va_s0 alg in_b out_b key round_keys keys_b hkeys_b h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks128 va_mods alg in_b out_b key round_keys keys_b hkeys_b h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks128 alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 210 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 255 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 261 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 262 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx
va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 265 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) out_b)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 267 column 131 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==>
FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64) (va_x_rdi:nat64) (va_x_r11:nat64)
(va_x_r10:nat64) (va_x_rdx:nat64) (va_x_r12:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm11:quad32) (va_x_xmm10:quad32)
(va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64
rR10 va_x_r10 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRbx
va_x_rbx (va_upd_mem va_x_mem va_s0))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) ==> va_k va_sM (())))
val va_wpProof_Gcm_blocks128 : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> h_LE:quad32 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b
h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks128 alg) ([va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6;
va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0;
va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi;
va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_blocks128 (va_code_Gcm_blocks128 alg) va_s0 alg in_b out_b key
round_keys keys_b hkeys_b h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 10
va_sM (va_update_xmm 11 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2
va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR12 va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) : (va_quickCode
unit (va_code_Gcm_blocks128 alg)) =
(va_QProc (va_code_Gcm_blocks128 alg) ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10;
va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64
rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem])
(va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE)
(va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE))
//--
//-- Gcm_blocks
#push-options "--z3rlimit 1000"
val va_code_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks alg offset =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx))
(va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64
32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp)
(offset + 0)) (va_CCons (va_code_Gcm_blocks_auth ()) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_CCons
(va_code_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp)
(offset + 24)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rR8) 0 Public) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Load_one_lsb
(va_op_xmm_xmm 10)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_xmm_xmm 10)) (va_CCons (va_code_AES_GCM_decrypt_6mult alg) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64
rRbp) 32 Secret) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp)
(offset + 32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_CCons (va_code_Gcm_blocks128 alg)
(va_CCons (va_code_Stack_lemma ()) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rR14)
(va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public)) (va_CCons (va_code_IMul64
(va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_CCons (va_IfElse
(va_cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (va_Block (va_CCons
(va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (va_CCons
(va_code_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_CCons
(va_code_Gcm_extra_bytes alg) (va_CCons (va_Block (va_CNil ())) (va_CNil ()))))))) (va_Block
(va_CNil ()))) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15))
(va_CCons (va_code_Gcm_make_length_quad ()) (va_CCons (va_code_Ghash_register ()) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRbp) 0 Secret) (va_CCons (va_code_Gctr_register alg) (va_CCons (va_Block (va_CNil ()))
(va_CNil ()))))))))))))))))))))))))))))))))))))
val va_codegen_success_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks alg offset =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9)
(va_const_opr64 32)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64
rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0)) (va_pbool_and
(va_codegen_success_Gcm_blocks_auth ()) (va_pbool_and (va_codegen_success_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp)
(offset + 16)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdx)
(va_op_reg_opr64_reg64 rRsp) (offset + 24)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR8) 0 Public)
(va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_pbool_and
(va_codegen_success_Load_one_lsb (va_op_xmm_xmm 10)) (va_pbool_and (va_codegen_success_VPaddd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_pbool_and
(va_codegen_success_AES_GCM_decrypt_6mult alg) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRbp) 32 Secret)
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRsp) (offset + 32)) (va_pbool_and (va_codegen_success_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp)
(offset + 48)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR14)
(va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 9)
(va_op_reg_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Pshufb (va_op_xmm_xmm 11)
(va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_Gcm_blocks128 alg) (va_pbool_and
(va_codegen_success_Stack_lemma ()) (va_pbool_and (va_codegen_success_Add64
(va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public))
(va_pbool_and (va_codegen_success_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16))
(va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rR13)
(va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_pbool_and (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp)
(offset + 56)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR10)
(va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR10)
(va_const_opr64 15)) (va_codegen_success_Gcm_extra_bytes alg)))) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_pbool_and
(va_codegen_success_Gcm_make_length_quad ()) (va_pbool_and (va_codegen_success_Ghash_register
()) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 0 Secret) (va_pbool_and
(va_codegen_success_Gctr_register alg) (va_ttrue ()))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks (va_mods:va_mods_t) (alg:algorithm) (offset:int) (auth_b:buffer128)
(abytes_b:buffer128) (in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128)
(out128_b:buffer128) (inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit
(va_code_Gcm_blocks alg offset)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 0) (va_get_stack va_s) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 8) (va_get_stack va_s) in let
(out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 16) (va_get_stack va_s) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 24) (va_get_stack va_s) in let
(in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 32) (va_get_stack va_s) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 40) (va_get_stack va_s) in let
(len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset
+ 48) (va_get_stack va_s) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 56) (va_get_stack va_s) in let
(plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s
+ offset + 64) (va_get_stack va_s) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_old_s)) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 463 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 464 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64 32))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 465 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 466 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_blocks_auth auth_b abytes_b hkeys_b h_LE) (fun (va_s:va_state)
(auth_quad_seq:(seq quad32)) -> let (y_0:quad32) = Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 0 in let (y_auth_bytes:quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 473 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 474 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 475 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 24))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 476 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 477 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> let
(iv_BE:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2
va_old_s) in let (ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32
iv_BE 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 483 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rR8) 0 Public iv_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 485 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp)
(va_op_xmm_xmm 1) 0 Secret scratch_b 0) (fun (va_s:va_state) _ -> let (j0:quad32) = va_get_xmm
1 va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 487 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load_one_lsb (va_op_xmm_xmm 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 489 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 491 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AES_GCM_decrypt_6mult alg h_LE iv_b in128x6_b out128x6_b scratch_b key round_keys
keys_b hkeys_b) (fun (va_s:va_state) _ -> let (y_cipher128x6:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (auth_in:(seq quad32)) =
auth_quad_seq in let (va_arg138:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) =
Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in let
(va_arg137:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let
(va_arg136:Vale.Def.Types_s.quad32) = y_auth_bytes in let (va_arg135:Vale.Def.Types_s.quad32) =
y_0 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 494 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg135 va_arg136
y_cipher128x6 va_arg137 va_arg138) (let auth_in = FStar.Seq.Base.append #quad32 auth_in
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 498 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11)
(va_op_reg_opr64_reg64 rRbp) 32 Secret scratch_b 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 499 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 500 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 32))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 501 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 502 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 503 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 504 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 505 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 506 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_blocks128 alg in128_b out128_b key round_keys keys_b hkeys_b h_LE) (fun
(va_s:va_state) _ -> let (y_cipher128:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (va_arg134:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b in let
(va_arg133:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let
(va_arg132:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 508 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg132 y_cipher128x6
y_cipher128 va_arg133 va_arg134) (let auth_in = FStar.Seq.Base.append #quad32 auth_in
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 512 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Stack_lemma (va_op_reg64_reg64 rRsp) (offset + 24) Public) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 512 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp)
(offset + 24) Public)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 513 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 514 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64))
(fun (va_s:va_state) _ -> let (y_inout:Vale.Def.Types_s.quad32) = y_cipher128 in let
(plain_byte_seq:(seq quad32)) = empty_seq_quad32 in let (cipher_byte_seq:(seq quad32)) =
empty_seq_quad32 in let (va_arg131:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_s in let
(va_arg130:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let
(va_arg129:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher_byte_seq in let
(va_arg128:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_byte_seq in let
(va_arg127:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 519 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_opaque_init va_arg127 va_arg128 va_arg129 va_arg130
va_arg131) (let (total_bytes:(va_int_at_least 0)) = FStar.Seq.Base.length #quad32 auth_quad_seq
`op_Multiply` 16 + plain_num_bytes in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 523 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_qIf va_mods (Cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (qblock va_mods (fun
(va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 525 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 526 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (fun (va_s:va_state) _
-> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 527 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 528 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 532 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes y_0 auth_in
h_LE) (fun (va_s:va_state) _ -> let y_inout = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm
8 va_s) in let (raw_auth_quads:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.append #quad32
auth_in (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b) in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 536 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 total_bytes)
(fun _ -> let (auth_input_bytes:(FStar.Seq.Base.seq Vale.Def.Types_s.nat8)) =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
raw_auth_quads) 0 total_bytes in let (padded_auth_bytes:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let auth_in =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let plain_byte_seq =
Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b in let cipher_byte_seq =
Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QEmpty ((auth_in,
cipher_byte_seq, plain_byte_seq, y_inout)))))))))) (qblock va_mods (fun (va_s:va_state) ->
va_QEmpty ((auth_in, cipher_byte_seq, plain_byte_seq, y_inout))))) (fun (va_s:va_state) va_g ->
let ((auth_in:(seq quad32)), (cipher_byte_seq:(seq quad32)), (plain_byte_seq:(seq quad32)),
(y_inout:Vale.Def.Types_s.quad32)) = va_g in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 547 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 548 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_make_length_quad ()) (fun (va_s:va_state) _ -> let
(length_quad32:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0
va_s) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 551 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_register hkeys_b h_LE y_inout) (fun (va_s:va_state) _ -> let
(y_final:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s)
in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 554 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRbp) 0 Secret scratch_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 557 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gctr_register alg key round_keys keys_b) (fun (va_s:va_state) _ -> let
(va_arg126:Vale.Def.Types_s.quad32) = va_get_xmm 8 va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 560 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.Arch.Types.le_seq_quad32_to_bytes_of_singleton va_arg126)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
((fun (icb_BE_677:Vale.Def.Types_s.quad32) (plain_LE_678:Vale.Def.Types_s.quad32)
(alg_679:Vale.AES.AES_common_s.algorithm) (key_680:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32))
(i_681:Prims.int) -> Vale.AES.AES_s.is_aes_key_LE alg_679 key_680) j0 y_final alg key 0) (fun _
-> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 8 va_s == Vale.AES.GCTR_s.gctr_encrypt_block j0 y_final alg key 0) (let
(plain128:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in let
(cipher128:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) in128_b) in va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 566 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.length #quad32 plain_byte_seq == 0 ==> FStar.Seq.Base.equal
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 plain128 plain_byte_seq)
plain128) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 567 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.length #quad32 cipher_byte_seq == 0 ==> FStar.Seq.Base.equal
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 cipher128 cipher_byte_seq)
cipher128) (let (va_arg125:Vale.Def.Types_s.quad32) = Vale.AES.GCTR.inc32lite ctr_BE_2 len128x6
in let (va_arg124:Vale.Def.Types_s.quad32) = ctr_BE_2 in let (va_arg123:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = key in let (va_arg122:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32))
= Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b in let
(va_arg121:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_old_s) in128_b in let (va_arg120:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out128x6_b in let
(va_arg119:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_old_s) in128x6_b in let (va_arg118:Prims.nat) = len128 in let
(va_arg117:Prims.nat) = len128x6 in let (va_arg116:Vale.AES.AES_common_s.algorithm) = alg in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 569 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg116 va_arg117 va_arg118
va_arg119 va_arg120 va_arg121 va_arg122 va_arg123 va_arg124 va_arg125) (let
(va_arg115:Vale.Def.Types_s.quad32) = Vale.AES.GCTR.inc32lite (Vale.AES.GCTR.inc32lite ctr_BE_2
len128x6) len128 in let (va_arg114:Vale.Def.Types_s.quad32) = ctr_BE_2 in let
(va_arg113:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let
(va_arg112:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher_byte_seq in let
(va_arg111:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_byte_seq in let
(va_arg110:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b) in let
(va_arg109:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in let (va_arg108:Prims.nat) =
FStar.Seq.Base.length #quad32 plain_byte_seq in let (va_arg107:Prims.nat) = len128x6 + len128
in let (va_arg106:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 575 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg106 va_arg107 va_arg108
va_arg109 va_arg110 va_arg111 va_arg112 va_arg113 va_arg114 va_arg115) (let
(va_arg105:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let
(va_arg104:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 583 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_hash_append2 h_LE va_arg104 y_inout y_final va_arg105
length_quad32) (let auth_in = FStar.Seq.Base.append #quad32 auth_in (FStar.Seq.Base.create
#Vale.Def.Types_s.quad32 1 length_quad32) in let (va_arg103:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = auth_in in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 585 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.ghash_incremental_to_ghash h_LE va_arg103) (va_QEmpty
(()))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Gcm_blocks : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> offset:int ->
auth_b:buffer128 -> abytes_b:buffer128 -> in128x6_b:buffer128 -> out128x6_b:buffer128 ->
in128_b:buffer128 -> out128_b:buffer128 -> inout_b:buffer128 -> iv_b:buffer128 ->
scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks alg offset) va_s0 /\ va_get_ok va_s0 /\
(let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_s0)) in sse_enabled /\ movbe_enabled /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0)
Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp
va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet
1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2
va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6
va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1
va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3
va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b;
scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\
Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b;
out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b;
hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b;
out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b;
out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b
== out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b)
/\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr
+ 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\
in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64
/\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b ==
va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==
len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\
plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 <
pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0
va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\
12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128
(128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128
`op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\
(va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\
va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128
`op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_s0)) in Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet
1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\ Vale.X64.Decls.modifies_buffer128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) /\
Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32
/\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let
(ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in let
(plain_in:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) else FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in128_b)) in let (cipher_out:(seq quad32)) = (if (plain_num_bytes
> (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM)
out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) else
FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM)
out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) in let
(cipher_bound:nat) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division`
8) then (len128x6 + len128 + 1) else (len128x6 + len128)) in Vale.AES.GCTR.gctr_partial alg
cipher_bound plain_in cipher_out key ctr_BE_2 /\ (let (length_quad:quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8
`op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply` plain_num_bytes) 0) in let
(raw_auth_quads:(seq quad32)) = (if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0
`op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_s0) abytes_b) else Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0)
auth_b) in let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64 rRsi va_s0) in let
(padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let
(auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let
(raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32
auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b))
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in let (total_bytes:nat) =
FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in let
(raw_quad_seq:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) then (let (ab:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let (pb:(seq
nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) else
raw_quad_seq) in let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 raw_quad_seq
(FStar.Seq.Base.create #quad32 1 length_quad) in va_get_xmm 8 va_sM ==
Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg
key 0))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM
(va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm
13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm
9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0)))))))))))))))))))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks va_b0 va_s0 alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks va_mods alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks alg offset) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 283 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64
(va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let
(in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in
let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in
let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in
let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in
let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in label va_range1
"***** POSTCONDITION NOT MET AT line 396 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 397 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 398 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 399 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 400 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet
6 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 403 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(plain_num_bytes < pow2_32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 404 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRsi va_s0 < pow2_32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (ctr_BE_1:quad32) = iv_BE in label va_range1
"***** POSTCONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 412 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (plain_in:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in128_b)) in label va_range1
"***** POSTCONDITION NOT MET AT line 421 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (cipher_out:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_sM) out128_b)) in label va_range1
"***** POSTCONDITION NOT MET AT line 430 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (cipher_bound:nat) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> len128x6 + len128 + 1) (fun _ -> len128x6 + len128) in label
va_range1
"***** POSTCONDITION NOT MET AT line 434 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 438 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (length_quad:quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 0) (8 `op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply`
plain_num_bytes) 0) in label va_range1
"***** POSTCONDITION NOT MET AT line 440 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (raw_auth_quads:(seq quad32)) = va_if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0
`op_Multiply` 128 `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_s0) abytes_b)) (fun _ -> Vale.X64.Decls.s128 (va_get_mem_heaplet 1
va_s0) auth_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 444 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64 rRsi va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 445 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in label
va_range1
"***** POSTCONDITION NOT MET AT line 446 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes
in label va_range1
"***** POSTCONDITION NOT MET AT line 448 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32
auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b))
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 452 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (total_bytes:nat) = FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 +
plain_num_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 453 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (raw_quad_seq:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply`
128 `op_Division` 8) (fun _ -> let (ab:(seq nat8)) = FStar.Seq.Base.slice
#Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32
raw_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let
(pb:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32
pb) (fun _ -> raw_quad_seq) in label va_range1
"***** POSTCONDITION NOT MET AT line 460 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 raw_quad_seq
(FStar.Seq.Base.create #quad32 1 length_quad) in label va_range1
"***** POSTCONDITION NOT MET AT line 461 column 106 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 8 va_sM == Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE
h_LE auth_quad_seq) alg key 0)))))))))))))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet
3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_blocks (alg:algorithm) (offset:int) (auth_b:buffer128) (abytes_b:buffer128)
(in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128) (out128_b:buffer128)
(inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64
(va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let
(in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in
let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in
let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in
let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in
let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in sse_enabled /\
movbe_enabled /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0)
(va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64
(va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet
1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2
va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6
va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1
va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3
va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b;
scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\
Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b;
out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b;
hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b;
out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b;
out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b
== out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b)
/\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr
+ 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\
in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64
/\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b ==
va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==
len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\
plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 <
pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0
va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\
12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128
(128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128
`op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\
(va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\
va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128
`op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)))) /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) (va_x_rdi:nat64)
(va_x_rsi:nat64) (va_x_rbp:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64) (va_x_r15:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_xmm15:quad32) (va_x_heap1:vale_heap) (va_x_heap2:vale_heap)
(va_x_heap3:vale_heap) (va_x_heap5:vale_heap) (va_x_heap6:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 6
va_x_heap6 (va_upd_mem_heaplet 5 va_x_heap5 (va_upd_mem_heaplet 3 va_x_heap3
(va_upd_mem_heaplet 2 va_x_heap2 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 15 va_x_xmm15
(va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11
va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRbp va_x_rbp (va_upd_reg64
rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem
va_s0))))))))))))))))))))))))))))))))))))) in va_get_ok va_sM /\ (let
(abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_s0)) in Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet
1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\ Vale.X64.Decls.modifies_buffer128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) /\
Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32
/\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let
(ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in let
(plain_in:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in128_b)) in let (cipher_out:(seq quad32)) = va_if
(plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) (fun _ ->
FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM)
inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM)
out128_b)) in let (cipher_bound:nat) = va_if (plain_num_bytes > (len128x6 + len128)
`op_Multiply` 128 `op_Division` 8) (fun _ -> len128x6 + len128 + 1) (fun _ -> len128x6 +
len128) in Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2 /\ (let
(length_quad:quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8
`op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply` plain_num_bytes) 0) in let
(raw_auth_quads:(seq quad32)) = va_if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0
`op_Multiply` 128 `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_s0) abytes_b)) (fun _ -> Vale.X64.Decls.s128 (va_get_mem_heaplet 1
va_s0) auth_b) in let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice
#Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64
rRsi va_s0) in let (padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits
auth_input_bytes in let (auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32
padded_auth_bytes in let (raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32
(FStar.Seq.Base.append #quad32 auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in128x6_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in let (total_bytes:nat)
= FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in let
(raw_quad_seq:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> let (ab:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let (pb:(seq
nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) (fun
_ -> raw_quad_seq) in let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32
raw_quad_seq (FStar.Seq.Base.create #quad32 1 length_quad) in va_get_xmm 8 va_sM ==
Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg
key 0))) ==> va_k va_sM (())))
val va_wpProof_Gcm_blocks : alg:algorithm -> offset:int -> auth_b:buffer128 -> abytes_b:buffer128
-> in128x6_b:buffer128 -> out128x6_b:buffer128 -> in128_b:buffer128 -> out128_b:buffer128 ->
inout_b:buffer128 -> iv_b:buffer128 -> scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq
quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b
in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks alg offset) ([va_Mod_flags;
va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2;
va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm
11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15;
va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi;
va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b
iv_b scratch_b key round_keys keys_b hkeys_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_blocks (va_code_Gcm_blocks alg offset) va_s0 alg offset auth_b
abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b
hkeys_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM
(va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm
13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm
9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0))))))))))))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet
3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_blocks (alg:algorithm) (offset:int) (auth_b:buffer128) (abytes_b:buffer128)
(in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128) (out128_b:buffer128)
(inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Gcm_blocks alg
offset)) =
(va_QProc (va_code_Gcm_blocks alg offset) ([va_Mod_flags; va_Mod_mem_heaplet 6;
va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1;
va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;
va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64
rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64
rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64
rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_Gcm_blocks alg offset auth_b
abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b
hkeys_b) (va_wpProof_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b))
#pop-options
//--
//-- Gcm_blocks_wrapped
#push-options "--z3rlimit 60"
val va_code_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> Tot va_code | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Lib.Basic.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.GHash.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESopt.fsti.checked",
"Vale.AES.X64.AESGCM.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.GCM.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GCMdecryptOpt.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Lib.Basic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 60,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | alg: Vale.AES.AES_common_s.algorithm -> offset: Prims.int -> Vale.X64.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Prims.int",
"Vale.X64.Decls.va_Block",
"Vale.X64.Decls.va_CCons",
"Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_blocks",
"Vale.X64.Decls.va_CNil",
"Vale.X64.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_Gcm_blocks_wrapped alg offset =
| (va_Block (va_CCons (va_code_Gcm_blocks alg offset)
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CNil ()))))) | false |
DM4F_layered5.fst | DM4F_layered5.return | val return (a: Type) (x: a) (st: Type0) : repr a st (return_wp x) | val return (a: Type) (x: a) (st: Type0) : repr a st (return_wp x) | let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0) | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 19,
"end_line": 51,
"start_col": 0,
"start_line": 50
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> x: a -> st: Type0 -> DM4F_layered5.repr a st (DM4F_layered5.return_wp x) | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.Mktuple2",
"FStar.Pervasives.Native.tuple2",
"DM4F_layered5.repr",
"DM4F_layered5.return_wp"
] | [] | false | false | false | false | false | let return (a: Type) (x: a) (st: Type0) : repr a st (return_wp x) =
| fun s0 -> (x, s0) | false |
Vale.AES.X64.GCMdecryptOpt.fst | Vale.AES.X64.GCMdecryptOpt.va_codegen_success_Gcm_blocks_wrapped | val va_codegen_success_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> Tot va_pbool | val va_codegen_success_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> Tot va_pbool | let va_codegen_success_Gcm_blocks_wrapped alg offset =
(va_pbool_and (va_codegen_success_Gcm_blocks alg offset) (va_ttrue ())) | {
"file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 73,
"end_line": 1367,
"start_col": 0,
"start_line": 1366
} | module Vale.AES.X64.GCMdecryptOpt
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GCM
open Vale.AES.GHash_s
open Vale.AES.GHash
open Vale.AES.GCM_s
open Vale.AES.X64.AES
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.Poly1305.Math
open Vale.AES.GCM_helpers
open Vale.AES.X64.GHash
open Vale.AES.X64.GCTR
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsStack
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.X64.GF128_Mul
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2.Bits_s
open Vale.AES.X64.AESopt
open Vale.AES.X64.AESGCM
open Vale.AES.X64.AESopt2
open Vale.Lib.Meta
open Vale.AES.X64.GCMencryptOpt
open Vale.AES.OptPublic
open Vale.Lib.Basic
#reset-options "--z3rlimit 20 --max_ifuel 0"
//-- Gcm_extra_bytes
val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_extra_bytes alg =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0)
(va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor
(va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_CNil ()))))))))))
val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_extra_bytes alg =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and
(va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat)
(old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit
(va_code_Gcm_extra_bytes alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range
1 1)) = 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRax) 0 Secret inout_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let
(hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s)
inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key
round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax)
(va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (()))))))))))))))
val va_lemma_Gcm_extra_bytes : va_b0:va_code -> va_s0:va_state -> alg:algorithm ->
inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) ->
h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_extra_bytes alg) va_s0 /\ va_get_ok va_s0 /\ (let
(len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b
inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b
len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM
(va_update_mem va_sM va_s0))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_extra_bytes va_b0 va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes
old_hash completed_quads h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_extra_bytes va_mods alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_extra_bytes alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 121 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (len:(va_int_range 1 1)) = 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 177 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 181 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE old_hash input_quads)))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\
Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b
inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax
va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\ (forall
(va_x_mem:vale_heap) (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm10:quad32) (va_x_heap5:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 5
va_x_heap5 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7
(va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRcx va_x_rcx (va_upd_mem va_x_mem va_s0)))))))))))))) in va_get_ok
va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==> va_k va_sM (())))
val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat ->
old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags;
va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_extra_bytes (va_code_Gcm_extra_bytes alg) va_s0 alg inout_b key
round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10
va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_extra_bytes alg)) =
(va_QProc (va_code_Gcm_extra_bytes alg) ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem])
(va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE) (va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE))
//--
//-- Gcm_blocks128
val va_code_Gcm_blocks128 : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks128 alg =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_CCons
(va_code_Ghash_buffer ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi)
(va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdx)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Gctr_blocks128 alg) (va_CNil ())))))))))
val va_codegen_success_Gcm_blocks128 : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks128 alg =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Ghash_buffer ()) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Gctr_blocks128 alg) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks128 (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128)
(key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32)
: (va_quickCode unit (va_code_Gcm_blocks128 alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 274 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 275 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 277 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_buffer hkeys_b in_b h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_old_s))) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gctr_blocks128 alg in_b out_b key round_keys keys_b) (va_QEmpty (()))))))))))
val va_lemma_Gcm_blocks128 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 ->
out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks128 alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 10 va_sM (va_update_xmm 11 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR11 va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks128 va_b0 va_s0 alg in_b out_b key round_keys keys_b hkeys_b h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks128 va_mods alg in_b out_b key round_keys keys_b hkeys_b h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks128 alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 210 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 255 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 261 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 262 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx
va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 265 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) out_b)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 267 column 131 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==>
FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64) (va_x_rdi:nat64) (va_x_r11:nat64)
(va_x_r10:nat64) (va_x_rdx:nat64) (va_x_r12:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm11:quad32) (va_x_xmm10:quad32)
(va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64
rR10 va_x_r10 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRbx
va_x_rbx (va_upd_mem va_x_mem va_s0))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) ==> va_k va_sM (())))
val va_wpProof_Gcm_blocks128 : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> h_LE:quad32 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b
h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks128 alg) ([va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6;
va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0;
va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi;
va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_blocks128 (va_code_Gcm_blocks128 alg) va_s0 alg in_b out_b key
round_keys keys_b hkeys_b h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 10
va_sM (va_update_xmm 11 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2
va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR12 va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) : (va_quickCode
unit (va_code_Gcm_blocks128 alg)) =
(va_QProc (va_code_Gcm_blocks128 alg) ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10;
va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64
rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem])
(va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE)
(va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE))
//--
//-- Gcm_blocks
#push-options "--z3rlimit 1000"
val va_code_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks alg offset =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx))
(va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64
32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp)
(offset + 0)) (va_CCons (va_code_Gcm_blocks_auth ()) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_CCons
(va_code_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp)
(offset + 24)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rR8) 0 Public) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Load_one_lsb
(va_op_xmm_xmm 10)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_xmm_xmm 10)) (va_CCons (va_code_AES_GCM_decrypt_6mult alg) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64
rRbp) 32 Secret) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp)
(offset + 32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_CCons (va_code_Gcm_blocks128 alg)
(va_CCons (va_code_Stack_lemma ()) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rR14)
(va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public)) (va_CCons (va_code_IMul64
(va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_CCons (va_IfElse
(va_cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (va_Block (va_CCons
(va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (va_CCons
(va_code_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_CCons
(va_code_Gcm_extra_bytes alg) (va_CCons (va_Block (va_CNil ())) (va_CNil ()))))))) (va_Block
(va_CNil ()))) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15))
(va_CCons (va_code_Gcm_make_length_quad ()) (va_CCons (va_code_Ghash_register ()) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRbp) 0 Secret) (va_CCons (va_code_Gctr_register alg) (va_CCons (va_Block (va_CNil ()))
(va_CNil ()))))))))))))))))))))))))))))))))))))
val va_codegen_success_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks alg offset =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9)
(va_const_opr64 32)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64
rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0)) (va_pbool_and
(va_codegen_success_Gcm_blocks_auth ()) (va_pbool_and (va_codegen_success_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp)
(offset + 16)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdx)
(va_op_reg_opr64_reg64 rRsp) (offset + 24)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR8) 0 Public)
(va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_pbool_and
(va_codegen_success_Load_one_lsb (va_op_xmm_xmm 10)) (va_pbool_and (va_codegen_success_VPaddd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_pbool_and
(va_codegen_success_AES_GCM_decrypt_6mult alg) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRbp) 32 Secret)
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRsp) (offset + 32)) (va_pbool_and (va_codegen_success_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp)
(offset + 48)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR14)
(va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 9)
(va_op_reg_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Pshufb (va_op_xmm_xmm 11)
(va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_Gcm_blocks128 alg) (va_pbool_and
(va_codegen_success_Stack_lemma ()) (va_pbool_and (va_codegen_success_Add64
(va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public))
(va_pbool_and (va_codegen_success_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16))
(va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rR13)
(va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_pbool_and (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp)
(offset + 56)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR10)
(va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR10)
(va_const_opr64 15)) (va_codegen_success_Gcm_extra_bytes alg)))) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_pbool_and
(va_codegen_success_Gcm_make_length_quad ()) (va_pbool_and (va_codegen_success_Ghash_register
()) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 0 Secret) (va_pbool_and
(va_codegen_success_Gctr_register alg) (va_ttrue ()))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks (va_mods:va_mods_t) (alg:algorithm) (offset:int) (auth_b:buffer128)
(abytes_b:buffer128) (in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128)
(out128_b:buffer128) (inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit
(va_code_Gcm_blocks alg offset)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 0) (va_get_stack va_s) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 8) (va_get_stack va_s) in let
(out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 16) (va_get_stack va_s) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 24) (va_get_stack va_s) in let
(in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 32) (va_get_stack va_s) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 40) (va_get_stack va_s) in let
(len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset
+ 48) (va_get_stack va_s) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 56) (va_get_stack va_s) in let
(plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s
+ offset + 64) (va_get_stack va_s) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_old_s)) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 463 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 464 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64 32))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 465 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 466 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_blocks_auth auth_b abytes_b hkeys_b h_LE) (fun (va_s:va_state)
(auth_quad_seq:(seq quad32)) -> let (y_0:quad32) = Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 0 in let (y_auth_bytes:quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 473 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 474 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 475 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 24))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 476 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 477 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> let
(iv_BE:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2
va_old_s) in let (ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32
iv_BE 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 483 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rR8) 0 Public iv_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 485 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp)
(va_op_xmm_xmm 1) 0 Secret scratch_b 0) (fun (va_s:va_state) _ -> let (j0:quad32) = va_get_xmm
1 va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 487 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load_one_lsb (va_op_xmm_xmm 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 489 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 491 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AES_GCM_decrypt_6mult alg h_LE iv_b in128x6_b out128x6_b scratch_b key round_keys
keys_b hkeys_b) (fun (va_s:va_state) _ -> let (y_cipher128x6:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (auth_in:(seq quad32)) =
auth_quad_seq in let (va_arg138:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) =
Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in let
(va_arg137:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let
(va_arg136:Vale.Def.Types_s.quad32) = y_auth_bytes in let (va_arg135:Vale.Def.Types_s.quad32) =
y_0 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 494 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg135 va_arg136
y_cipher128x6 va_arg137 va_arg138) (let auth_in = FStar.Seq.Base.append #quad32 auth_in
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 498 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11)
(va_op_reg_opr64_reg64 rRbp) 32 Secret scratch_b 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 499 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 500 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 32))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 501 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 502 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 503 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 504 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 505 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 506 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_blocks128 alg in128_b out128_b key round_keys keys_b hkeys_b h_LE) (fun
(va_s:va_state) _ -> let (y_cipher128:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (va_arg134:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b in let
(va_arg133:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let
(va_arg132:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 508 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg132 y_cipher128x6
y_cipher128 va_arg133 va_arg134) (let auth_in = FStar.Seq.Base.append #quad32 auth_in
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 512 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Stack_lemma (va_op_reg64_reg64 rRsp) (offset + 24) Public) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 512 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp)
(offset + 24) Public)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 513 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 514 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64))
(fun (va_s:va_state) _ -> let (y_inout:Vale.Def.Types_s.quad32) = y_cipher128 in let
(plain_byte_seq:(seq quad32)) = empty_seq_quad32 in let (cipher_byte_seq:(seq quad32)) =
empty_seq_quad32 in let (va_arg131:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_s in let
(va_arg130:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let
(va_arg129:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher_byte_seq in let
(va_arg128:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_byte_seq in let
(va_arg127:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 519 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_opaque_init va_arg127 va_arg128 va_arg129 va_arg130
va_arg131) (let (total_bytes:(va_int_at_least 0)) = FStar.Seq.Base.length #quad32 auth_quad_seq
`op_Multiply` 16 + plain_num_bytes in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 523 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_qIf va_mods (Cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (qblock va_mods (fun
(va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 525 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 526 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (fun (va_s:va_state) _
-> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 527 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 528 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 532 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes y_0 auth_in
h_LE) (fun (va_s:va_state) _ -> let y_inout = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm
8 va_s) in let (raw_auth_quads:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.append #quad32
auth_in (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b) in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 536 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 total_bytes)
(fun _ -> let (auth_input_bytes:(FStar.Seq.Base.seq Vale.Def.Types_s.nat8)) =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
raw_auth_quads) 0 total_bytes in let (padded_auth_bytes:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let auth_in =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let plain_byte_seq =
Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b in let cipher_byte_seq =
Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QEmpty ((auth_in,
cipher_byte_seq, plain_byte_seq, y_inout)))))))))) (qblock va_mods (fun (va_s:va_state) ->
va_QEmpty ((auth_in, cipher_byte_seq, plain_byte_seq, y_inout))))) (fun (va_s:va_state) va_g ->
let ((auth_in:(seq quad32)), (cipher_byte_seq:(seq quad32)), (plain_byte_seq:(seq quad32)),
(y_inout:Vale.Def.Types_s.quad32)) = va_g in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 547 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 548 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_make_length_quad ()) (fun (va_s:va_state) _ -> let
(length_quad32:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0
va_s) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 551 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_register hkeys_b h_LE y_inout) (fun (va_s:va_state) _ -> let
(y_final:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s)
in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 554 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRbp) 0 Secret scratch_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 557 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gctr_register alg key round_keys keys_b) (fun (va_s:va_state) _ -> let
(va_arg126:Vale.Def.Types_s.quad32) = va_get_xmm 8 va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 560 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.Arch.Types.le_seq_quad32_to_bytes_of_singleton va_arg126)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
((fun (icb_BE_677:Vale.Def.Types_s.quad32) (plain_LE_678:Vale.Def.Types_s.quad32)
(alg_679:Vale.AES.AES_common_s.algorithm) (key_680:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32))
(i_681:Prims.int) -> Vale.AES.AES_s.is_aes_key_LE alg_679 key_680) j0 y_final alg key 0) (fun _
-> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 8 va_s == Vale.AES.GCTR_s.gctr_encrypt_block j0 y_final alg key 0) (let
(plain128:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in let
(cipher128:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) in128_b) in va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 566 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.length #quad32 plain_byte_seq == 0 ==> FStar.Seq.Base.equal
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 plain128 plain_byte_seq)
plain128) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 567 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.length #quad32 cipher_byte_seq == 0 ==> FStar.Seq.Base.equal
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 cipher128 cipher_byte_seq)
cipher128) (let (va_arg125:Vale.Def.Types_s.quad32) = Vale.AES.GCTR.inc32lite ctr_BE_2 len128x6
in let (va_arg124:Vale.Def.Types_s.quad32) = ctr_BE_2 in let (va_arg123:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = key in let (va_arg122:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32))
= Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b in let
(va_arg121:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_old_s) in128_b in let (va_arg120:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out128x6_b in let
(va_arg119:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_old_s) in128x6_b in let (va_arg118:Prims.nat) = len128 in let
(va_arg117:Prims.nat) = len128x6 in let (va_arg116:Vale.AES.AES_common_s.algorithm) = alg in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 569 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg116 va_arg117 va_arg118
va_arg119 va_arg120 va_arg121 va_arg122 va_arg123 va_arg124 va_arg125) (let
(va_arg115:Vale.Def.Types_s.quad32) = Vale.AES.GCTR.inc32lite (Vale.AES.GCTR.inc32lite ctr_BE_2
len128x6) len128 in let (va_arg114:Vale.Def.Types_s.quad32) = ctr_BE_2 in let
(va_arg113:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let
(va_arg112:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher_byte_seq in let
(va_arg111:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_byte_seq in let
(va_arg110:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b) in let
(va_arg109:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in let (va_arg108:Prims.nat) =
FStar.Seq.Base.length #quad32 plain_byte_seq in let (va_arg107:Prims.nat) = len128x6 + len128
in let (va_arg106:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 575 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg106 va_arg107 va_arg108
va_arg109 va_arg110 va_arg111 va_arg112 va_arg113 va_arg114 va_arg115) (let
(va_arg105:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let
(va_arg104:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 583 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_hash_append2 h_LE va_arg104 y_inout y_final va_arg105
length_quad32) (let auth_in = FStar.Seq.Base.append #quad32 auth_in (FStar.Seq.Base.create
#Vale.Def.Types_s.quad32 1 length_quad32) in let (va_arg103:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = auth_in in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 585 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.ghash_incremental_to_ghash h_LE va_arg103) (va_QEmpty
(()))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Gcm_blocks : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> offset:int ->
auth_b:buffer128 -> abytes_b:buffer128 -> in128x6_b:buffer128 -> out128x6_b:buffer128 ->
in128_b:buffer128 -> out128_b:buffer128 -> inout_b:buffer128 -> iv_b:buffer128 ->
scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks alg offset) va_s0 /\ va_get_ok va_s0 /\
(let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_s0)) in sse_enabled /\ movbe_enabled /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0)
Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp
va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet
1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2
va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6
va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1
va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3
va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b;
scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\
Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b;
out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b;
hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b;
out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b;
out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b
== out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b)
/\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr
+ 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\
in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64
/\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b ==
va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==
len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\
plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 <
pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0
va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\
12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128
(128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128
`op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\
(va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\
va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128
`op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_s0)) in Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet
1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\ Vale.X64.Decls.modifies_buffer128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) /\
Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32
/\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let
(ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in let
(plain_in:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) else FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in128_b)) in let (cipher_out:(seq quad32)) = (if (plain_num_bytes
> (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM)
out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) else
FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM)
out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) in let
(cipher_bound:nat) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division`
8) then (len128x6 + len128 + 1) else (len128x6 + len128)) in Vale.AES.GCTR.gctr_partial alg
cipher_bound plain_in cipher_out key ctr_BE_2 /\ (let (length_quad:quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8
`op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply` plain_num_bytes) 0) in let
(raw_auth_quads:(seq quad32)) = (if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0
`op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_s0) abytes_b) else Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0)
auth_b) in let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64 rRsi va_s0) in let
(padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let
(auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let
(raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32
auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b))
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in let (total_bytes:nat) =
FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in let
(raw_quad_seq:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) then (let (ab:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let (pb:(seq
nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) else
raw_quad_seq) in let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 raw_quad_seq
(FStar.Seq.Base.create #quad32 1 length_quad) in va_get_xmm 8 va_sM ==
Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg
key 0))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM
(va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm
13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm
9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0)))))))))))))))))))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks va_b0 va_s0 alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks va_mods alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks alg offset) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 283 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64
(va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let
(in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in
let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in
let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in
let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in
let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in label va_range1
"***** POSTCONDITION NOT MET AT line 396 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 397 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 398 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 399 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 400 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet
6 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 403 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(plain_num_bytes < pow2_32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 404 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRsi va_s0 < pow2_32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (ctr_BE_1:quad32) = iv_BE in label va_range1
"***** POSTCONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 412 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (plain_in:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in128_b)) in label va_range1
"***** POSTCONDITION NOT MET AT line 421 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (cipher_out:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_sM) out128_b)) in label va_range1
"***** POSTCONDITION NOT MET AT line 430 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (cipher_bound:nat) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> len128x6 + len128 + 1) (fun _ -> len128x6 + len128) in label
va_range1
"***** POSTCONDITION NOT MET AT line 434 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 438 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (length_quad:quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 0) (8 `op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply`
plain_num_bytes) 0) in label va_range1
"***** POSTCONDITION NOT MET AT line 440 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (raw_auth_quads:(seq quad32)) = va_if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0
`op_Multiply` 128 `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_s0) abytes_b)) (fun _ -> Vale.X64.Decls.s128 (va_get_mem_heaplet 1
va_s0) auth_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 444 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64 rRsi va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 445 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in label
va_range1
"***** POSTCONDITION NOT MET AT line 446 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes
in label va_range1
"***** POSTCONDITION NOT MET AT line 448 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32
auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b))
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 452 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (total_bytes:nat) = FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 +
plain_num_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 453 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (raw_quad_seq:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply`
128 `op_Division` 8) (fun _ -> let (ab:(seq nat8)) = FStar.Seq.Base.slice
#Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32
raw_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let
(pb:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32
pb) (fun _ -> raw_quad_seq) in label va_range1
"***** POSTCONDITION NOT MET AT line 460 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 raw_quad_seq
(FStar.Seq.Base.create #quad32 1 length_quad) in label va_range1
"***** POSTCONDITION NOT MET AT line 461 column 106 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 8 va_sM == Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE
h_LE auth_quad_seq) alg key 0)))))))))))))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet
3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_blocks (alg:algorithm) (offset:int) (auth_b:buffer128) (abytes_b:buffer128)
(in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128) (out128_b:buffer128)
(inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64
(va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let
(in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in
let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in
let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in
let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in
let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in sse_enabled /\
movbe_enabled /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0)
(va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64
(va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet
1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2
va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6
va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1
va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3
va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b;
scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\
Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b;
out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b;
hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b;
out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b;
out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b
== out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b)
/\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr
+ 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\
in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64
/\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b ==
va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==
len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\
plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 <
pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0
va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\
12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128
(128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128
`op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\
(va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\
va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128
`op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)))) /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) (va_x_rdi:nat64)
(va_x_rsi:nat64) (va_x_rbp:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64) (va_x_r15:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_xmm15:quad32) (va_x_heap1:vale_heap) (va_x_heap2:vale_heap)
(va_x_heap3:vale_heap) (va_x_heap5:vale_heap) (va_x_heap6:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 6
va_x_heap6 (va_upd_mem_heaplet 5 va_x_heap5 (va_upd_mem_heaplet 3 va_x_heap3
(va_upd_mem_heaplet 2 va_x_heap2 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 15 va_x_xmm15
(va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11
va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRbp va_x_rbp (va_upd_reg64
rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem
va_s0))))))))))))))))))))))))))))))))))))) in va_get_ok va_sM /\ (let
(abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_s0)) in Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet
1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\ Vale.X64.Decls.modifies_buffer128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) /\
Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32
/\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let
(ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in let
(plain_in:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in128_b)) in let (cipher_out:(seq quad32)) = va_if
(plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) (fun _ ->
FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM)
inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM)
out128_b)) in let (cipher_bound:nat) = va_if (plain_num_bytes > (len128x6 + len128)
`op_Multiply` 128 `op_Division` 8) (fun _ -> len128x6 + len128 + 1) (fun _ -> len128x6 +
len128) in Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2 /\ (let
(length_quad:quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8
`op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply` plain_num_bytes) 0) in let
(raw_auth_quads:(seq quad32)) = va_if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0
`op_Multiply` 128 `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_s0) abytes_b)) (fun _ -> Vale.X64.Decls.s128 (va_get_mem_heaplet 1
va_s0) auth_b) in let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice
#Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64
rRsi va_s0) in let (padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits
auth_input_bytes in let (auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32
padded_auth_bytes in let (raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32
(FStar.Seq.Base.append #quad32 auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in128x6_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in let (total_bytes:nat)
= FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in let
(raw_quad_seq:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> let (ab:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let (pb:(seq
nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) (fun
_ -> raw_quad_seq) in let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32
raw_quad_seq (FStar.Seq.Base.create #quad32 1 length_quad) in va_get_xmm 8 va_sM ==
Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg
key 0))) ==> va_k va_sM (())))
val va_wpProof_Gcm_blocks : alg:algorithm -> offset:int -> auth_b:buffer128 -> abytes_b:buffer128
-> in128x6_b:buffer128 -> out128x6_b:buffer128 -> in128_b:buffer128 -> out128_b:buffer128 ->
inout_b:buffer128 -> iv_b:buffer128 -> scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq
quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b
in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks alg offset) ([va_Mod_flags;
va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2;
va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm
11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15;
va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi;
va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b
iv_b scratch_b key round_keys keys_b hkeys_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_blocks (va_code_Gcm_blocks alg offset) va_s0 alg offset auth_b
abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b
hkeys_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM
(va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm
13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm
9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0))))))))))))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet
3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_blocks (alg:algorithm) (offset:int) (auth_b:buffer128) (abytes_b:buffer128)
(in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128) (out128_b:buffer128)
(inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Gcm_blocks alg
offset)) =
(va_QProc (va_code_Gcm_blocks alg offset) ([va_Mod_flags; va_Mod_mem_heaplet 6;
va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1;
va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;
va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64
rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64
rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64
rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_Gcm_blocks alg offset auth_b
abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b
hkeys_b) (va_wpProof_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b))
#pop-options
//--
//-- Gcm_blocks_wrapped
#push-options "--z3rlimit 60"
val va_code_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks_wrapped alg offset =
(va_Block (va_CCons (va_code_Gcm_blocks alg offset) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_Block (va_CNil ())) (va_CNil ())))))
val va_codegen_success_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> Tot va_pbool | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Lib.Basic.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.GHash.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESopt.fsti.checked",
"Vale.AES.X64.AESGCM.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.GCM.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GCMdecryptOpt.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Lib.Basic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 60,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | alg: Vale.AES.AES_common_s.algorithm -> offset: Prims.int -> Vale.X64.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Prims.int",
"Vale.X64.Decls.va_pbool_and",
"Vale.AES.X64.GCMdecryptOpt.va_codegen_success_Gcm_blocks",
"Vale.X64.Decls.va_ttrue",
"Vale.X64.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_Gcm_blocks_wrapped alg offset =
| (va_pbool_and (va_codegen_success_Gcm_blocks alg offset) (va_ttrue ())) | false |
DM4F_layered5.fst | DM4F_layered5.ite_wp | val ite_wp (#a #st: _) (b: bool) (w1 w2: wp st a) : wp st a | val ite_wp (#a #st: _) (b: bool) (w1 w2: wp st a) : wp st a | let ite_wp #a #st (b:bool) (w1 w2 : wp st a) : wp st a =
fun s0 p -> (b ==> w1 s0 p) /\ ((~b) ==> w2 s0 p) | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 73,
"start_col": 0,
"start_line": 72
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0)
unfold
let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)
let bind (a:Type) (b:Type) (st:Type0)
(wp_c : wp st a)
(wp_f : a -> wp st b)
(c : repr a st wp_c)
(f : (x:a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f)
= fun s0 ->
//let (y, s1) = c s0 in
//f y s1
// GM: argh! using the match above introduces noise in the VC, a true precondition
// that becomes a pain since we don't have monotonicity nor even extensionality
let r = c s0 in
f (fst r) (snd r) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: Prims.bool -> w1: DM4F_layered5.wp st a -> w2: DM4F_layered5.wp st a -> DM4F_layered5.wp st a | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"DM4F_layered5.wp",
"DM4F_layered5.post_t",
"Prims.l_and",
"Prims.l_imp",
"Prims.b2t",
"Prims.l_not",
"Prims.logical"
] | [] | false | false | false | true | false | let ite_wp #a #st (b: bool) (w1: wp st a) (w2: wp st a) : wp st a =
| fun s0 p -> (b ==> w1 s0 p) /\ ((~b) ==> w2 s0 p) | false |
DM4F_layered5.fst | DM4F_layered5.bind_wp | val bind_wp (#a #b: Type) (#st: Type0) (w1: wp st a) (w2: (a -> wp st b)) : wp st b | val bind_wp (#a #b: Type) (#st: Type0) (w1: wp st a) (w2: (a -> wp st b)) : wp st b | let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p) | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 43,
"end_line": 56,
"start_col": 0,
"start_line": 54
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | w1: DM4F_layered5.wp st a -> w2: (_: a -> DM4F_layered5.wp st b) -> DM4F_layered5.wp st b | Prims.Tot | [
"total"
] | [] | [
"DM4F_layered5.wp",
"DM4F_layered5.post_t"
] | [] | false | false | false | true | false | let bind_wp (#a #b: Type) (#st: Type0) (w1: wp st a) (w2: (a -> wp st b)) : wp st b =
| fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p) | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.comp_st_with_post | val comp_st_with_post (c: comp_st) (post: term)
: c': comp_st{st_comp_of_comp c' == ({ st_comp_of_comp c with post = post } <: st_comp)} | val comp_st_with_post (c: comp_st) (post: term)
: c': comp_st{st_comp_of_comp c' == ({ st_comp_of_comp c with post = post } <: st_comp)} | let comp_st_with_post (c:comp_st) (post:term)
: c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } =
match c with
| C_ST st -> C_ST { st with post }
| C_STGhost st -> C_STGhost { st with post }
| C_STAtomic i obs st -> C_STAtomic i obs {st with post} | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 58,
"end_line": 215,
"start_col": 0,
"start_line": 210
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r
let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Pulse.Syntax.Base.comp_st -> post: Pulse.Syntax.Base.term
-> c':
Pulse.Syntax.Base.comp_st
{ Pulse.Syntax.Base.st_comp_of_comp c' ==
(let _ = Pulse.Syntax.Base.st_comp_of_comp c in
Pulse.Syntax.Base.Mkst_comp (Mkst_comp?.u _) (Mkst_comp?.res _) (Mkst_comp?.pre _) post) } | Prims.Tot | [
"total"
] | [] | [
"Pulse.Syntax.Base.comp_st",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.st_comp",
"Pulse.Syntax.Base.C_ST",
"Pulse.Syntax.Base.Mkst_comp",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__u",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__res",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__pre",
"Pulse.Syntax.Base.C_STGhost",
"Pulse.Syntax.Base.observability",
"Pulse.Syntax.Base.C_STAtomic",
"Prims.eq2",
"Pulse.Syntax.Base.st_comp_of_comp"
] | [] | false | false | false | false | false | let comp_st_with_post (c: comp_st) (post: term)
: c': comp_st{st_comp_of_comp c' == ({ st_comp_of_comp c with post = post } <: st_comp)} =
| match c with
| C_ST st -> C_ST ({ st with post = post })
| C_STGhost st -> C_STGhost ({ st with post = post })
| C_STAtomic i obs st -> C_STAtomic i obs ({ st with post = post }) | false |
DM4F_layered5.fst | DM4F_layered5.lift_id_st_wp | val lift_id_st_wp (#a #st: _) (w: ID5.wp a) : wp st a | val lift_id_st_wp (#a #st: _) (w: ID5.wp a) : wp st a | let lift_id_st_wp #a #st (w : ID5.wp a) : wp st a =
elim_pure_wp_monotonicity_forall ();
fun s0 p -> w (fun x -> p x s0) | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 33,
"end_line": 110,
"start_col": 0,
"start_line": 108
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0)
unfold
let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)
let bind (a:Type) (b:Type) (st:Type0)
(wp_c : wp st a)
(wp_f : a -> wp st b)
(c : repr a st wp_c)
(f : (x:a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f)
= fun s0 ->
//let (y, s1) = c s0 in
//f y s1
// GM: argh! using the match above introduces noise in the VC, a true precondition
// that becomes a pain since we don't have monotonicity nor even extensionality
let r = c s0 in
f (fst r) (snd r)
let ite_wp #a #st (b:bool) (w1 w2 : wp st a) : wp st a =
fun s0 p -> (b ==> w1 s0 p) /\ ((~b) ==> w2 s0 p)
let if_then_else
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(f : repr a st wpf)
(g : repr a st wpg)
(b : bool)
: Type
= repr a st (ite_wp b wpf wpg)
let stronger
(#a:Type) (#st:Type0)
(w1 w2 : wp st a)
: Type0
= forall s0 p. w1 s0 p ==> w2 s0 p
let subcomp
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(#[@@@ refine] u : squash (stronger wpg wpf))
(f : repr a st wpf)
: repr a st wpg
= f
total
reifiable
reflectable
effect {
ST (a:Type) ([@@@ effect_param] st:Type0) (_:wp st a)
with {repr; return; bind; subcomp; if_then_else}
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | w: ID5.wp a -> DM4F_layered5.wp st a | Prims.Tot | [
"total"
] | [] | [
"ID5.wp",
"Prims.l_True",
"Prims.pure_pre",
"Prims.unit",
"FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall",
"DM4F_layered5.wp"
] | [] | false | false | false | true | false | let lift_id_st_wp #a #st (w: ID5.wp a) : wp st a =
| elim_pure_wp_monotonicity_forall ();
fun s0 p -> w (fun x -> p x s0) | false |
DM4F_layered5.fst | DM4F_layered5.null | val null (#st #a: _) : wp st a | val null (#st #a: _) : wp st a | let null #st #a : wp st a =
fun s0 p -> forall x s1. p x s1 | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 33,
"end_line": 119,
"start_col": 0,
"start_line": 118
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0)
unfold
let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)
let bind (a:Type) (b:Type) (st:Type0)
(wp_c : wp st a)
(wp_f : a -> wp st b)
(c : repr a st wp_c)
(f : (x:a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f)
= fun s0 ->
//let (y, s1) = c s0 in
//f y s1
// GM: argh! using the match above introduces noise in the VC, a true precondition
// that becomes a pain since we don't have monotonicity nor even extensionality
let r = c s0 in
f (fst r) (snd r)
let ite_wp #a #st (b:bool) (w1 w2 : wp st a) : wp st a =
fun s0 p -> (b ==> w1 s0 p) /\ ((~b) ==> w2 s0 p)
let if_then_else
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(f : repr a st wpf)
(g : repr a st wpg)
(b : bool)
: Type
= repr a st (ite_wp b wpf wpg)
let stronger
(#a:Type) (#st:Type0)
(w1 w2 : wp st a)
: Type0
= forall s0 p. w1 s0 p ==> w2 s0 p
let subcomp
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(#[@@@ refine] u : squash (stronger wpg wpf))
(f : repr a st wpf)
: repr a st wpg
= f
total
reifiable
reflectable
effect {
ST (a:Type) ([@@@ effect_param] st:Type0) (_:wp st a)
with {repr; return; bind; subcomp; if_then_else}
}
let lift_id_st_wp #a #st (w : ID5.wp a) : wp st a =
elim_pure_wp_monotonicity_forall ();
fun s0 p -> w (fun x -> p x s0)
let lift_id_st a wp st (f : ID5.repr a wp)
: repr a st (lift_id_st_wp wp)
= fun s0 -> ID5.ID?.reflect (ID5.bind _ _ _ _ f (fun x -> ID5.return _ (x, s0)))
sub_effect ID ~> ST = lift_id_st | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | DM4F_layered5.wp st a | Prims.Tot | [
"total"
] | [] | [
"Prims.l_Forall",
"Prims.logical",
"DM4F_layered5.wp"
] | [] | false | false | false | true | false | let null #st #a : wp st a =
| fun s0 p -> forall x s1. p x s1 | false |
DM4F_layered5.fst | DM4F_layered5.bind | val bind
(a b: Type)
(st: Type0)
(wp_c: wp st a)
(wp_f: (a -> wp st b))
(c: repr a st wp_c)
(f: (x: a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f) | val bind
(a b: Type)
(st: Type0)
(wp_c: wp st a)
(wp_f: (a -> wp st b))
(c: repr a st wp_c)
(f: (x: a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f) | let bind (a:Type) (b:Type) (st:Type0)
(wp_c : wp st a)
(wp_f : a -> wp st b)
(c : repr a st wp_c)
(f : (x:a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f)
= fun s0 ->
//let (y, s1) = c s0 in
//f y s1
// GM: argh! using the match above introduces noise in the VC, a true precondition
// that becomes a pain since we don't have monotonicity nor even extensionality
let r = c s0 in
f (fst r) (snd r) | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 23,
"end_line": 70,
"start_col": 0,
"start_line": 58
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0)
unfold
let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Type ->
b: Type ->
st: Type0 ->
wp_c: DM4F_layered5.wp st a ->
wp_f: (_: a -> DM4F_layered5.wp st b) ->
c: DM4F_layered5.repr a st wp_c ->
f: (x: a -> DM4F_layered5.repr b st (wp_f x))
-> DM4F_layered5.repr b st (DM4F_layered5.bind_wp wp_c wp_f) | Prims.Tot | [
"total"
] | [] | [
"DM4F_layered5.wp",
"DM4F_layered5.repr",
"FStar.Pervasives.Native.fst",
"FStar.Pervasives.Native.snd",
"FStar.Pervasives.Native.tuple2",
"DM4F_layered5.bind_wp"
] | [] | false | false | false | false | false | let bind
(a b: Type)
(st: Type0)
(wp_c: wp st a)
(wp_f: (a -> wp st b))
(c: repr a st wp_c)
(f: (x: a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f) =
| fun s0 ->
let r = c s0 in
f (fst r) (snd r) | false |
DM4F_layered5.fst | DM4F_layered5.subcomp | val subcomp
(a: Type)
(st: Type0)
(wpf wpg: wp st a)
(#[@@@ refine]u: squash (stronger wpg wpf))
(f: repr a st wpf)
: repr a st wpg | val subcomp
(a: Type)
(st: Type0)
(wpf wpg: wp st a)
(#[@@@ refine]u: squash (stronger wpg wpf))
(f: repr a st wpf)
: repr a st wpg | let subcomp
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(#[@@@ refine] u : squash (stronger wpg wpf))
(f : repr a st wpf)
: repr a st wpg
= f | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 5,
"end_line": 98,
"start_col": 0,
"start_line": 91
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0)
unfold
let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)
let bind (a:Type) (b:Type) (st:Type0)
(wp_c : wp st a)
(wp_f : a -> wp st b)
(c : repr a st wp_c)
(f : (x:a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f)
= fun s0 ->
//let (y, s1) = c s0 in
//f y s1
// GM: argh! using the match above introduces noise in the VC, a true precondition
// that becomes a pain since we don't have monotonicity nor even extensionality
let r = c s0 in
f (fst r) (snd r)
let ite_wp #a #st (b:bool) (w1 w2 : wp st a) : wp st a =
fun s0 p -> (b ==> w1 s0 p) /\ ((~b) ==> w2 s0 p)
let if_then_else
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(f : repr a st wpf)
(g : repr a st wpg)
(b : bool)
: Type
= repr a st (ite_wp b wpf wpg)
let stronger
(#a:Type) (#st:Type0)
(w1 w2 : wp st a)
: Type0
= forall s0 p. w1 s0 p ==> w2 s0 p | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Type ->
st: Type0 ->
wpf: DM4F_layered5.wp st a ->
wpg: DM4F_layered5.wp st a ->
f: DM4F_layered5.repr a st wpf
-> DM4F_layered5.repr a st wpg | Prims.Tot | [
"total"
] | [] | [
"DM4F_layered5.wp",
"Prims.squash",
"DM4F_layered5.stronger",
"DM4F_layered5.repr"
] | [] | false | false | false | false | false | let subcomp
(a: Type)
(st: Type0)
(wpf wpg: wp st a)
(#[@@@ refine]u: squash (stronger wpg wpf))
(f: repr a st wpf)
: repr a st wpg =
| f | false |
FStar.Bytes.fsti | FStar.Bytes.index | val index : b: FStar.Bytes.bytes -> i: Prims.nat{i < FStar.Bytes.length b} -> FStar.Bytes.byte | let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i) | {
"file_name": "ulib/FStar.Bytes.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 74,
"end_line": 100,
"start_col": 7,
"start_line": 100
} | (*
Copyright 2008-2017 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.
*)
(*
A standard library for manipulation of value bytes.
This model is realized by Bytes.bytes in OCaml and by
struct {uintX_t size; char *bytes} (or similar) in C.
This file is essentially a specialized version of FStar.Seq,
with lemmas and refinements taylored for typical operations on
bytes, and with support for machine integers and C-extractible versions
(which Seq does not provide.)
@summary Value bytes standard library
*)
module FStar.Bytes
module S = FStar.Seq
module U = FStar.UInt
module U8 = FStar.UInt8
module U16 = FStar.UInt16
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Str = FStar.String
module Chr = FStar.Char
unfold let u8 = U8.t
unfold let u16 = U16.t
unfold let u32 = U32.t
(** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *)
unfold type byte = u8
(** Realized in C by a pair of a length field and uint8_t* in C
Realized in OCaml by a string *)
val bytes : t:Type0{hasEq t}
val len : bytes -> u32
unfold let length b = FStar.UInt32.v (len b)
(** representation for specs that need lemmas not defined here. *)
val reveal:
bytes
-> GTot (S.seq byte)
val length_reveal:
x:bytes
-> Lemma (ensures (S.length (reveal x) = length x))
[SMTPatOr [[SMTPat (S.length (reveal x))];
[SMTPat (len x)]]]
val hide:
s:S.seq byte{S.length s < pow2 32}
-> GTot bytes
val hide_reveal:
x:bytes
-> Lemma (ensures (hide (reveal x) = x))
[SMTPat (reveal x)]
val reveal_hide:
x:S.seq byte{S.length x < pow2 32}
-> Lemma (ensures (reveal (hide x) == x))
[SMTPat (hide x)]
type lbytes (l:nat) = b:bytes{length b = l}
type kbytes (k:nat) = b:bytes{length b < pow2 k}
let lbytes32 (l:UInt32.t) = b:bytes{len b = l}
val empty_bytes : lbytes 0
val empty_unique:
b:bytes
-> Lemma (length b = 0 ==> b = empty_bytes)
[SMTPat (len b)]
(** If you statically know the length, it is OK to read at arbitrary indexes *)
val get:
b:bytes
-> pos:u32{U32.v pos < length b}
-> Pure byte
(requires True)
(ensures (fun y -> y == S.index (reveal b) (U32.v pos)))
unfold let op_String_Access = get | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.String.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.Char.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Bytes.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Char",
"short_module": "Chr"
},
{
"abbrev": true,
"full_module": "FStar.String",
"short_module": "Str"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: FStar.Bytes.bytes -> i: Prims.nat{i < FStar.Bytes.length b} -> FStar.Bytes.byte | Prims.Tot | [
"total"
] | [] | [
"FStar.Bytes.bytes",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Bytes.length",
"FStar.Bytes.get",
"FStar.UInt32.uint_to_t",
"FStar.Bytes.byte"
] | [] | false | false | false | false | false | let index (b: bytes) (i: nat{i < length b}) =
| get b (U32.uint_to_t i) | false |
|
FStar.Bytes.fsti | FStar.Bytes.create_ | val create_ : n: Prims.nat{FStar.UInt.size n FStar.UInt32.n} -> v: FStar.Bytes.byte
-> b:
FStar.Bytes.lbytes (FStar.UInt32.v (FStar.UInt32.uint_to_t n))
{forall (i: FStar.Bytes.u32{i <^ FStar.UInt32.uint_to_t n}). {:pattern b.[ i ]} b.[ i ] == v} | let create_ (n:nat{FStar.UInt.size n U32.n}) v = create (U32.uint_to_t n) v | {
"file_name": "ulib/FStar.Bytes.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 75,
"end_line": 119,
"start_col": 0,
"start_line": 119
} | (*
Copyright 2008-2017 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.
*)
(*
A standard library for manipulation of value bytes.
This model is realized by Bytes.bytes in OCaml and by
struct {uintX_t size; char *bytes} (or similar) in C.
This file is essentially a specialized version of FStar.Seq,
with lemmas and refinements taylored for typical operations on
bytes, and with support for machine integers and C-extractible versions
(which Seq does not provide.)
@summary Value bytes standard library
*)
module FStar.Bytes
module S = FStar.Seq
module U = FStar.UInt
module U8 = FStar.UInt8
module U16 = FStar.UInt16
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Str = FStar.String
module Chr = FStar.Char
unfold let u8 = U8.t
unfold let u16 = U16.t
unfold let u32 = U32.t
(** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *)
unfold type byte = u8
(** Realized in C by a pair of a length field and uint8_t* in C
Realized in OCaml by a string *)
val bytes : t:Type0{hasEq t}
val len : bytes -> u32
unfold let length b = FStar.UInt32.v (len b)
(** representation for specs that need lemmas not defined here. *)
val reveal:
bytes
-> GTot (S.seq byte)
val length_reveal:
x:bytes
-> Lemma (ensures (S.length (reveal x) = length x))
[SMTPatOr [[SMTPat (S.length (reveal x))];
[SMTPat (len x)]]]
val hide:
s:S.seq byte{S.length s < pow2 32}
-> GTot bytes
val hide_reveal:
x:bytes
-> Lemma (ensures (hide (reveal x) = x))
[SMTPat (reveal x)]
val reveal_hide:
x:S.seq byte{S.length x < pow2 32}
-> Lemma (ensures (reveal (hide x) == x))
[SMTPat (hide x)]
type lbytes (l:nat) = b:bytes{length b = l}
type kbytes (k:nat) = b:bytes{length b < pow2 k}
let lbytes32 (l:UInt32.t) = b:bytes{len b = l}
val empty_bytes : lbytes 0
val empty_unique:
b:bytes
-> Lemma (length b = 0 ==> b = empty_bytes)
[SMTPat (len b)]
(** If you statically know the length, it is OK to read at arbitrary indexes *)
val get:
b:bytes
-> pos:u32{U32.v pos < length b}
-> Pure byte
(requires True)
(ensures (fun y -> y == S.index (reveal b) (U32.v pos)))
unfold let op_String_Access = get
unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i)
let equal b1 b2 =
length b1 = length b2 /\
(forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i])
val extensionality:
b1:bytes
-> b2:bytes
-> Lemma (requires (equal b1 b2))
(ensures (b1 = b2))
(** creating byte values **)
val create:
len:u32
-> v:byte
-> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == v} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.String.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.Char.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Bytes.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Char",
"short_module": "Chr"
},
{
"abbrev": true,
"full_module": "FStar.String",
"short_module": "Str"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.nat{FStar.UInt.size n FStar.UInt32.n} -> v: FStar.Bytes.byte
-> b:
FStar.Bytes.lbytes (FStar.UInt32.v (FStar.UInt32.uint_to_t n))
{forall (i: FStar.Bytes.u32{i <^ FStar.UInt32.uint_to_t n}). {:pattern b.[ i ]} b.[ i ] == v} | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"FStar.UInt.size",
"FStar.UInt32.n",
"FStar.Bytes.byte",
"FStar.Bytes.create",
"FStar.UInt32.uint_to_t",
"FStar.Bytes.lbytes",
"FStar.UInt32.v",
"Prims.l_Forall",
"FStar.Bytes.u32",
"Prims.b2t",
"FStar.UInt32.op_Less_Hat",
"Prims.eq2",
"FStar.Bytes.op_String_Access"
] | [] | false | false | false | false | false | let create_ (n: nat{FStar.UInt.size n U32.n}) v =
| create (U32.uint_to_t n) v | false |
|
FStar.Bytes.fsti | FStar.Bytes.slice_ | val slice_ : b: FStar.Bytes.bytes -> s: Prims.nat -> e: Prims.nat{s <= e /\ e <= FStar.Bytes.length b}
-> r:
FStar.Bytes.bytes
{ FStar.Bytes.reveal r ==
FStar.Seq.Base.slice (FStar.Bytes.reveal b)
(FStar.UInt32.v (FStar.UInt32.uint_to_t s))
(FStar.UInt32.v (FStar.UInt32.uint_to_t e)) } | let slice_ b (s:nat) (e:nat{s <= e /\ e <= length b}) = slice b (U32.uint_to_t s) (U32.uint_to_t e) | {
"file_name": "ulib/FStar.Bytes.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 99,
"end_line": 147,
"start_col": 0,
"start_line": 147
} | (*
Copyright 2008-2017 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.
*)
(*
A standard library for manipulation of value bytes.
This model is realized by Bytes.bytes in OCaml and by
struct {uintX_t size; char *bytes} (or similar) in C.
This file is essentially a specialized version of FStar.Seq,
with lemmas and refinements taylored for typical operations on
bytes, and with support for machine integers and C-extractible versions
(which Seq does not provide.)
@summary Value bytes standard library
*)
module FStar.Bytes
module S = FStar.Seq
module U = FStar.UInt
module U8 = FStar.UInt8
module U16 = FStar.UInt16
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Str = FStar.String
module Chr = FStar.Char
unfold let u8 = U8.t
unfold let u16 = U16.t
unfold let u32 = U32.t
(** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *)
unfold type byte = u8
(** Realized in C by a pair of a length field and uint8_t* in C
Realized in OCaml by a string *)
val bytes : t:Type0{hasEq t}
val len : bytes -> u32
unfold let length b = FStar.UInt32.v (len b)
(** representation for specs that need lemmas not defined here. *)
val reveal:
bytes
-> GTot (S.seq byte)
val length_reveal:
x:bytes
-> Lemma (ensures (S.length (reveal x) = length x))
[SMTPatOr [[SMTPat (S.length (reveal x))];
[SMTPat (len x)]]]
val hide:
s:S.seq byte{S.length s < pow2 32}
-> GTot bytes
val hide_reveal:
x:bytes
-> Lemma (ensures (hide (reveal x) = x))
[SMTPat (reveal x)]
val reveal_hide:
x:S.seq byte{S.length x < pow2 32}
-> Lemma (ensures (reveal (hide x) == x))
[SMTPat (hide x)]
type lbytes (l:nat) = b:bytes{length b = l}
type kbytes (k:nat) = b:bytes{length b < pow2 k}
let lbytes32 (l:UInt32.t) = b:bytes{len b = l}
val empty_bytes : lbytes 0
val empty_unique:
b:bytes
-> Lemma (length b = 0 ==> b = empty_bytes)
[SMTPat (len b)]
(** If you statically know the length, it is OK to read at arbitrary indexes *)
val get:
b:bytes
-> pos:u32{U32.v pos < length b}
-> Pure byte
(requires True)
(ensures (fun y -> y == S.index (reveal b) (U32.v pos)))
unfold let op_String_Access = get
unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i)
let equal b1 b2 =
length b1 = length b2 /\
(forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i])
val extensionality:
b1:bytes
-> b2:bytes
-> Lemma (requires (equal b1 b2))
(ensures (b1 = b2))
(** creating byte values **)
val create:
len:u32
-> v:byte
-> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == v}
unfold
let create_ (n:nat{FStar.UInt.size n U32.n}) v = create (U32.uint_to_t n) v
val init:
len:u32
-> f:(i:u32{U32.(i <^ len)} -> byte)
-> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == f i}
// this is a hack JROESCH
val abyte (b:byte) : lbytes 1
(* admit () create 1ul b *)
val twobytes (b:byte*byte) : lbytes 2
// init 2ul (fun i -> if i = 0ul then fst b else snd b)
(** appending bytes **)
val append:
b1:bytes
-> b2:bytes
-> Pure bytes
(requires (UInt.size (length b1 + length b2) U32.n))
(ensures (fun b -> reveal b == S.append (reveal b1) (reveal b2)))
unfold let op_At_Bar = append
val slice:
b:bytes
-> s:u32
-> e:u32{U32.(s <=^ e) /\ U32.v e <= length b} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.String.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.Char.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Bytes.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Char",
"short_module": "Chr"
},
{
"abbrev": true,
"full_module": "FStar.String",
"short_module": "Str"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: FStar.Bytes.bytes -> s: Prims.nat -> e: Prims.nat{s <= e /\ e <= FStar.Bytes.length b}
-> r:
FStar.Bytes.bytes
{ FStar.Bytes.reveal r ==
FStar.Seq.Base.slice (FStar.Bytes.reveal b)
(FStar.UInt32.v (FStar.UInt32.uint_to_t s))
(FStar.UInt32.v (FStar.UInt32.uint_to_t e)) } | Prims.Tot | [
"total"
] | [] | [
"FStar.Bytes.bytes",
"Prims.nat",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Bytes.length",
"FStar.Bytes.slice",
"FStar.UInt32.uint_to_t",
"Prims.eq2",
"FStar.Seq.Base.seq",
"FStar.Bytes.byte",
"FStar.Bytes.reveal",
"FStar.Seq.Base.slice",
"FStar.UInt32.v"
] | [] | false | false | false | false | false | let slice_ b (s: nat) (e: nat{s <= e /\ e <= length b}) =
| slice b (U32.uint_to_t s) (U32.uint_to_t e) | false |
|
Pulse.Checker.Base.fst | Pulse.Checker.Base.k_elab_trans | val k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2 | val k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2 | let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res) | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 57,
"end_line": 208,
"start_col": 0,
"start_line": 203
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
k0: Pulse.Checker.Base.continuation_elaborator g0 ctxt0 g1 ctxt1 ->
k1:
Pulse.Checker.Base.continuation_elaborator g1 ctxt1 g2 ctxt2
{Pulse.Typing.Env.env_extends g1 g0}
-> Pulse.Checker.Base.continuation_elaborator g0 ctxt0 g2 ctxt2 | Prims.Tot | [
"total"
] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Typing.Env.env_extends",
"Pulse.Syntax.Base.term",
"Pulse.Checker.Base.continuation_elaborator",
"Pulse.Typing.post_hint_opt",
"Pulse.Typing.Combinators.st_typing_in_ctxt"
] | [] | false | false | false | false | false | let k_elab_trans
(#g0: env)
(#g1: env{g1 `env_extends` g0})
(#g2: env{g2 `env_extends` g1})
(#ctxt0 #ctxt1 #ctxt2: term)
(k0: continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1: continuation_elaborator g1 ctxt1 g2 ctxt2 {g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2 =
| fun post_hint res -> k0 post_hint (k1 post_hint res) | false |
Vale.AES.X64.GCMdecryptOpt.fst | Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_blocks_decrypt_stdcall | val va_code_Gcm_blocks_decrypt_stdcall : win:bool -> alg:algorithm -> Tot va_code | val va_code_Gcm_blocks_decrypt_stdcall : win:bool -> alg:algorithm -> Tot va_code | let va_code_Gcm_blocks_decrypt_stdcall win alg =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Save_registers win) (va_CCons (if win then va_Block (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rR8) (va_op_reg_opr64_reg64 rRsp) (224 + 40 + 0)) (va_CCons
(va_code_Load64_stack (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRsp) (224 + 40 + 8))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rRsp) (224
+ 40 + 88)) (va_CNil ())))))))) else va_Block (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rRsp) (64 + 8 + 72)) (va_CNil ())))
(va_CCons (va_code_Gcm_blocks_wrapped alg (Vale.X64.Decls.total_if #int win (224 + 56) (64 +
8))) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rR15) (va_op_reg_opr64_reg64 rRsp)
(Vale.X64.Decls.total_if #int win (224 + 40 + 96) (64 + 8 + 80))) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rR15) 0 Secret) (va_CCons (va_code_XmmEqual (va_op_xmm_xmm 0) (va_op_xmm_xmm 8)) (va_CCons
(va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_Restore_registers
win) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rRcx)) (va_CCons
(va_code_DestroyHeaplets ()) (va_CNil ())))))))))))))))) | {
"file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 60,
"end_line": 1936,
"start_col": 0,
"start_line": 1916
} | module Vale.AES.X64.GCMdecryptOpt
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GCM
open Vale.AES.GHash_s
open Vale.AES.GHash
open Vale.AES.GCM_s
open Vale.AES.X64.AES
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.Poly1305.Math
open Vale.AES.GCM_helpers
open Vale.AES.X64.GHash
open Vale.AES.X64.GCTR
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsStack
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.X64.GF128_Mul
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2.Bits_s
open Vale.AES.X64.AESopt
open Vale.AES.X64.AESGCM
open Vale.AES.X64.AESopt2
open Vale.Lib.Meta
open Vale.AES.X64.GCMencryptOpt
open Vale.AES.OptPublic
open Vale.Lib.Basic
#reset-options "--z3rlimit 20 --max_ifuel 0"
//-- Gcm_extra_bytes
val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_extra_bytes alg =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0)
(va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor
(va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_CNil ()))))))))))
val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_extra_bytes alg =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and
(va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat)
(old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit
(va_code_Gcm_extra_bytes alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range
1 1)) = 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRax) 0 Secret inout_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let
(hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s)
inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key
round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax)
(va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (()))))))))))))))
val va_lemma_Gcm_extra_bytes : va_b0:va_code -> va_s0:va_state -> alg:algorithm ->
inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) ->
h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_extra_bytes alg) va_s0 /\ va_get_ok va_s0 /\ (let
(len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b
inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b
len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM
(va_update_mem va_sM va_s0))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_extra_bytes va_b0 va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes
old_hash completed_quads h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_extra_bytes va_mods alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_extra_bytes alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 121 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (len:(va_int_range 1 1)) = 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 177 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 181 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE old_hash input_quads)))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\
Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b
inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax
va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\ (forall
(va_x_mem:vale_heap) (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm10:quad32) (va_x_heap5:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 5
va_x_heap5 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7
(va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRcx va_x_rcx (va_upd_mem va_x_mem va_s0)))))))))))))) in va_get_ok
va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==> va_k va_sM (())))
val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat ->
old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags;
va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_extra_bytes (va_code_Gcm_extra_bytes alg) va_s0 alg inout_b key
round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10
va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_extra_bytes alg)) =
(va_QProc (va_code_Gcm_extra_bytes alg) ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem])
(va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE) (va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE))
//--
//-- Gcm_blocks128
val va_code_Gcm_blocks128 : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks128 alg =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_CCons
(va_code_Ghash_buffer ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi)
(va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdx)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Gctr_blocks128 alg) (va_CNil ())))))))))
val va_codegen_success_Gcm_blocks128 : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks128 alg =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Ghash_buffer ()) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Gctr_blocks128 alg) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks128 (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128)
(key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32)
: (va_quickCode unit (va_code_Gcm_blocks128 alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 274 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 275 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 277 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_buffer hkeys_b in_b h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_old_s))) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gctr_blocks128 alg in_b out_b key round_keys keys_b) (va_QEmpty (()))))))))))
val va_lemma_Gcm_blocks128 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 ->
out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks128 alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 10 va_sM (va_update_xmm 11 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR11 va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks128 va_b0 va_s0 alg in_b out_b key round_keys keys_b hkeys_b h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks128 va_mods alg in_b out_b key round_keys keys_b hkeys_b h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks128 alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 210 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 255 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 261 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 262 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx
va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 265 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) out_b)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 267 column 131 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==>
FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64) (va_x_rdi:nat64) (va_x_r11:nat64)
(va_x_r10:nat64) (va_x_rdx:nat64) (va_x_r12:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm11:quad32) (va_x_xmm10:quad32)
(va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64
rR10 va_x_r10 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRbx
va_x_rbx (va_upd_mem va_x_mem va_s0))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) ==> va_k va_sM (())))
val va_wpProof_Gcm_blocks128 : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> h_LE:quad32 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b
h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks128 alg) ([va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6;
va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0;
va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi;
va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_blocks128 (va_code_Gcm_blocks128 alg) va_s0 alg in_b out_b key
round_keys keys_b hkeys_b h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 10
va_sM (va_update_xmm 11 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2
va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR12 va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) : (va_quickCode
unit (va_code_Gcm_blocks128 alg)) =
(va_QProc (va_code_Gcm_blocks128 alg) ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10;
va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64
rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem])
(va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE)
(va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE))
//--
//-- Gcm_blocks
#push-options "--z3rlimit 1000"
val va_code_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks alg offset =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx))
(va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64
32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp)
(offset + 0)) (va_CCons (va_code_Gcm_blocks_auth ()) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_CCons
(va_code_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp)
(offset + 24)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rR8) 0 Public) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Load_one_lsb
(va_op_xmm_xmm 10)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_xmm_xmm 10)) (va_CCons (va_code_AES_GCM_decrypt_6mult alg) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64
rRbp) 32 Secret) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp)
(offset + 32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_CCons (va_code_Gcm_blocks128 alg)
(va_CCons (va_code_Stack_lemma ()) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rR14)
(va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public)) (va_CCons (va_code_IMul64
(va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_CCons (va_IfElse
(va_cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (va_Block (va_CCons
(va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (va_CCons
(va_code_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_CCons
(va_code_Gcm_extra_bytes alg) (va_CCons (va_Block (va_CNil ())) (va_CNil ()))))))) (va_Block
(va_CNil ()))) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15))
(va_CCons (va_code_Gcm_make_length_quad ()) (va_CCons (va_code_Ghash_register ()) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRbp) 0 Secret) (va_CCons (va_code_Gctr_register alg) (va_CCons (va_Block (va_CNil ()))
(va_CNil ()))))))))))))))))))))))))))))))))))))
val va_codegen_success_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks alg offset =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9)
(va_const_opr64 32)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64
rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0)) (va_pbool_and
(va_codegen_success_Gcm_blocks_auth ()) (va_pbool_and (va_codegen_success_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp)
(offset + 16)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdx)
(va_op_reg_opr64_reg64 rRsp) (offset + 24)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR8) 0 Public)
(va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_pbool_and
(va_codegen_success_Load_one_lsb (va_op_xmm_xmm 10)) (va_pbool_and (va_codegen_success_VPaddd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_pbool_and
(va_codegen_success_AES_GCM_decrypt_6mult alg) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRbp) 32 Secret)
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRsp) (offset + 32)) (va_pbool_and (va_codegen_success_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp)
(offset + 48)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR14)
(va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 9)
(va_op_reg_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Pshufb (va_op_xmm_xmm 11)
(va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_Gcm_blocks128 alg) (va_pbool_and
(va_codegen_success_Stack_lemma ()) (va_pbool_and (va_codegen_success_Add64
(va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public))
(va_pbool_and (va_codegen_success_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16))
(va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rR13)
(va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_pbool_and (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp)
(offset + 56)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR10)
(va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR10)
(va_const_opr64 15)) (va_codegen_success_Gcm_extra_bytes alg)))) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_pbool_and
(va_codegen_success_Gcm_make_length_quad ()) (va_pbool_and (va_codegen_success_Ghash_register
()) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 0 Secret) (va_pbool_and
(va_codegen_success_Gctr_register alg) (va_ttrue ()))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks (va_mods:va_mods_t) (alg:algorithm) (offset:int) (auth_b:buffer128)
(abytes_b:buffer128) (in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128)
(out128_b:buffer128) (inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit
(va_code_Gcm_blocks alg offset)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 0) (va_get_stack va_s) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 8) (va_get_stack va_s) in let
(out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 16) (va_get_stack va_s) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 24) (va_get_stack va_s) in let
(in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 32) (va_get_stack va_s) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 40) (va_get_stack va_s) in let
(len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset
+ 48) (va_get_stack va_s) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 56) (va_get_stack va_s) in let
(plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s
+ offset + 64) (va_get_stack va_s) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_old_s)) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 463 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 464 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64 32))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 465 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 466 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_blocks_auth auth_b abytes_b hkeys_b h_LE) (fun (va_s:va_state)
(auth_quad_seq:(seq quad32)) -> let (y_0:quad32) = Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 0 in let (y_auth_bytes:quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 473 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 474 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 475 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 24))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 476 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 477 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> let
(iv_BE:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2
va_old_s) in let (ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32
iv_BE 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 483 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rR8) 0 Public iv_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 485 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp)
(va_op_xmm_xmm 1) 0 Secret scratch_b 0) (fun (va_s:va_state) _ -> let (j0:quad32) = va_get_xmm
1 va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 487 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load_one_lsb (va_op_xmm_xmm 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 489 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 491 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AES_GCM_decrypt_6mult alg h_LE iv_b in128x6_b out128x6_b scratch_b key round_keys
keys_b hkeys_b) (fun (va_s:va_state) _ -> let (y_cipher128x6:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (auth_in:(seq quad32)) =
auth_quad_seq in let (va_arg138:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) =
Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in let
(va_arg137:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let
(va_arg136:Vale.Def.Types_s.quad32) = y_auth_bytes in let (va_arg135:Vale.Def.Types_s.quad32) =
y_0 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 494 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg135 va_arg136
y_cipher128x6 va_arg137 va_arg138) (let auth_in = FStar.Seq.Base.append #quad32 auth_in
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 498 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11)
(va_op_reg_opr64_reg64 rRbp) 32 Secret scratch_b 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 499 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 500 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 32))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 501 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 502 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 503 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 504 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 505 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 506 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_blocks128 alg in128_b out128_b key round_keys keys_b hkeys_b h_LE) (fun
(va_s:va_state) _ -> let (y_cipher128:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (va_arg134:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b in let
(va_arg133:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let
(va_arg132:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 508 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg132 y_cipher128x6
y_cipher128 va_arg133 va_arg134) (let auth_in = FStar.Seq.Base.append #quad32 auth_in
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 512 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Stack_lemma (va_op_reg64_reg64 rRsp) (offset + 24) Public) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 512 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp)
(offset + 24) Public)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 513 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 514 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64))
(fun (va_s:va_state) _ -> let (y_inout:Vale.Def.Types_s.quad32) = y_cipher128 in let
(plain_byte_seq:(seq quad32)) = empty_seq_quad32 in let (cipher_byte_seq:(seq quad32)) =
empty_seq_quad32 in let (va_arg131:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_s in let
(va_arg130:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let
(va_arg129:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher_byte_seq in let
(va_arg128:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_byte_seq in let
(va_arg127:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 519 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_opaque_init va_arg127 va_arg128 va_arg129 va_arg130
va_arg131) (let (total_bytes:(va_int_at_least 0)) = FStar.Seq.Base.length #quad32 auth_quad_seq
`op_Multiply` 16 + plain_num_bytes in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 523 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_qIf va_mods (Cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (qblock va_mods (fun
(va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 525 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 526 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (fun (va_s:va_state) _
-> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 527 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 528 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 532 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes y_0 auth_in
h_LE) (fun (va_s:va_state) _ -> let y_inout = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm
8 va_s) in let (raw_auth_quads:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.append #quad32
auth_in (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b) in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 536 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 total_bytes)
(fun _ -> let (auth_input_bytes:(FStar.Seq.Base.seq Vale.Def.Types_s.nat8)) =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
raw_auth_quads) 0 total_bytes in let (padded_auth_bytes:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let auth_in =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let plain_byte_seq =
Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b in let cipher_byte_seq =
Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QEmpty ((auth_in,
cipher_byte_seq, plain_byte_seq, y_inout)))))))))) (qblock va_mods (fun (va_s:va_state) ->
va_QEmpty ((auth_in, cipher_byte_seq, plain_byte_seq, y_inout))))) (fun (va_s:va_state) va_g ->
let ((auth_in:(seq quad32)), (cipher_byte_seq:(seq quad32)), (plain_byte_seq:(seq quad32)),
(y_inout:Vale.Def.Types_s.quad32)) = va_g in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 547 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 548 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_make_length_quad ()) (fun (va_s:va_state) _ -> let
(length_quad32:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0
va_s) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 551 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_register hkeys_b h_LE y_inout) (fun (va_s:va_state) _ -> let
(y_final:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s)
in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 554 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRbp) 0 Secret scratch_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 557 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gctr_register alg key round_keys keys_b) (fun (va_s:va_state) _ -> let
(va_arg126:Vale.Def.Types_s.quad32) = va_get_xmm 8 va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 560 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.Arch.Types.le_seq_quad32_to_bytes_of_singleton va_arg126)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
((fun (icb_BE_677:Vale.Def.Types_s.quad32) (plain_LE_678:Vale.Def.Types_s.quad32)
(alg_679:Vale.AES.AES_common_s.algorithm) (key_680:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32))
(i_681:Prims.int) -> Vale.AES.AES_s.is_aes_key_LE alg_679 key_680) j0 y_final alg key 0) (fun _
-> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 8 va_s == Vale.AES.GCTR_s.gctr_encrypt_block j0 y_final alg key 0) (let
(plain128:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in let
(cipher128:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) in128_b) in va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 566 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.length #quad32 plain_byte_seq == 0 ==> FStar.Seq.Base.equal
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 plain128 plain_byte_seq)
plain128) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 567 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.length #quad32 cipher_byte_seq == 0 ==> FStar.Seq.Base.equal
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 cipher128 cipher_byte_seq)
cipher128) (let (va_arg125:Vale.Def.Types_s.quad32) = Vale.AES.GCTR.inc32lite ctr_BE_2 len128x6
in let (va_arg124:Vale.Def.Types_s.quad32) = ctr_BE_2 in let (va_arg123:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = key in let (va_arg122:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32))
= Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b in let
(va_arg121:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_old_s) in128_b in let (va_arg120:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out128x6_b in let
(va_arg119:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_old_s) in128x6_b in let (va_arg118:Prims.nat) = len128 in let
(va_arg117:Prims.nat) = len128x6 in let (va_arg116:Vale.AES.AES_common_s.algorithm) = alg in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 569 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg116 va_arg117 va_arg118
va_arg119 va_arg120 va_arg121 va_arg122 va_arg123 va_arg124 va_arg125) (let
(va_arg115:Vale.Def.Types_s.quad32) = Vale.AES.GCTR.inc32lite (Vale.AES.GCTR.inc32lite ctr_BE_2
len128x6) len128 in let (va_arg114:Vale.Def.Types_s.quad32) = ctr_BE_2 in let
(va_arg113:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let
(va_arg112:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher_byte_seq in let
(va_arg111:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_byte_seq in let
(va_arg110:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b) in let
(va_arg109:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in let (va_arg108:Prims.nat) =
FStar.Seq.Base.length #quad32 plain_byte_seq in let (va_arg107:Prims.nat) = len128x6 + len128
in let (va_arg106:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 575 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg106 va_arg107 va_arg108
va_arg109 va_arg110 va_arg111 va_arg112 va_arg113 va_arg114 va_arg115) (let
(va_arg105:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let
(va_arg104:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 583 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_hash_append2 h_LE va_arg104 y_inout y_final va_arg105
length_quad32) (let auth_in = FStar.Seq.Base.append #quad32 auth_in (FStar.Seq.Base.create
#Vale.Def.Types_s.quad32 1 length_quad32) in let (va_arg103:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = auth_in in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 585 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.ghash_incremental_to_ghash h_LE va_arg103) (va_QEmpty
(()))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Gcm_blocks : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> offset:int ->
auth_b:buffer128 -> abytes_b:buffer128 -> in128x6_b:buffer128 -> out128x6_b:buffer128 ->
in128_b:buffer128 -> out128_b:buffer128 -> inout_b:buffer128 -> iv_b:buffer128 ->
scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks alg offset) va_s0 /\ va_get_ok va_s0 /\
(let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_s0)) in sse_enabled /\ movbe_enabled /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0)
Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp
va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet
1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2
va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6
va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1
va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3
va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b;
scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\
Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b;
out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b;
hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b;
out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b;
out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b
== out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b)
/\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr
+ 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\
in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64
/\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b ==
va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==
len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\
plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 <
pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0
va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\
12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128
(128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128
`op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\
(va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\
va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128
`op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_s0)) in Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet
1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\ Vale.X64.Decls.modifies_buffer128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) /\
Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32
/\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let
(ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in let
(plain_in:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) else FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in128_b)) in let (cipher_out:(seq quad32)) = (if (plain_num_bytes
> (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM)
out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) else
FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM)
out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) in let
(cipher_bound:nat) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division`
8) then (len128x6 + len128 + 1) else (len128x6 + len128)) in Vale.AES.GCTR.gctr_partial alg
cipher_bound plain_in cipher_out key ctr_BE_2 /\ (let (length_quad:quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8
`op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply` plain_num_bytes) 0) in let
(raw_auth_quads:(seq quad32)) = (if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0
`op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_s0) abytes_b) else Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0)
auth_b) in let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64 rRsi va_s0) in let
(padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let
(auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let
(raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32
auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b))
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in let (total_bytes:nat) =
FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in let
(raw_quad_seq:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) then (let (ab:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let (pb:(seq
nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) else
raw_quad_seq) in let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 raw_quad_seq
(FStar.Seq.Base.create #quad32 1 length_quad) in va_get_xmm 8 va_sM ==
Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg
key 0))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM
(va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm
13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm
9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0)))))))))))))))))))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks va_b0 va_s0 alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks va_mods alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks alg offset) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 283 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64
(va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let
(in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in
let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in
let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in
let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in
let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in label va_range1
"***** POSTCONDITION NOT MET AT line 396 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 397 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 398 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 399 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 400 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet
6 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 403 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(plain_num_bytes < pow2_32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 404 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRsi va_s0 < pow2_32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (ctr_BE_1:quad32) = iv_BE in label va_range1
"***** POSTCONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 412 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (plain_in:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in128_b)) in label va_range1
"***** POSTCONDITION NOT MET AT line 421 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (cipher_out:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_sM) out128_b)) in label va_range1
"***** POSTCONDITION NOT MET AT line 430 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (cipher_bound:nat) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> len128x6 + len128 + 1) (fun _ -> len128x6 + len128) in label
va_range1
"***** POSTCONDITION NOT MET AT line 434 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 438 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (length_quad:quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 0) (8 `op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply`
plain_num_bytes) 0) in label va_range1
"***** POSTCONDITION NOT MET AT line 440 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (raw_auth_quads:(seq quad32)) = va_if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0
`op_Multiply` 128 `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_s0) abytes_b)) (fun _ -> Vale.X64.Decls.s128 (va_get_mem_heaplet 1
va_s0) auth_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 444 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64 rRsi va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 445 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in label
va_range1
"***** POSTCONDITION NOT MET AT line 446 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes
in label va_range1
"***** POSTCONDITION NOT MET AT line 448 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32
auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b))
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 452 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (total_bytes:nat) = FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 +
plain_num_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 453 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (raw_quad_seq:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply`
128 `op_Division` 8) (fun _ -> let (ab:(seq nat8)) = FStar.Seq.Base.slice
#Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32
raw_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let
(pb:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32
pb) (fun _ -> raw_quad_seq) in label va_range1
"***** POSTCONDITION NOT MET AT line 460 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 raw_quad_seq
(FStar.Seq.Base.create #quad32 1 length_quad) in label va_range1
"***** POSTCONDITION NOT MET AT line 461 column 106 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 8 va_sM == Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE
h_LE auth_quad_seq) alg key 0)))))))))))))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet
3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_blocks (alg:algorithm) (offset:int) (auth_b:buffer128) (abytes_b:buffer128)
(in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128) (out128_b:buffer128)
(inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64
(va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let
(in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in
let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in
let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in
let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in
let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in sse_enabled /\
movbe_enabled /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0)
(va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64
(va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet
1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2
va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6
va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1
va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3
va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b;
scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\
Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b;
out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b;
hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b;
out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b;
out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b
== out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b)
/\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr
+ 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\
in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64
/\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b ==
va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==
len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\
plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 <
pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0
va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\
12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128
(128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128
`op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\
(va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\
va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128
`op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)))) /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) (va_x_rdi:nat64)
(va_x_rsi:nat64) (va_x_rbp:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64) (va_x_r15:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_xmm15:quad32) (va_x_heap1:vale_heap) (va_x_heap2:vale_heap)
(va_x_heap3:vale_heap) (va_x_heap5:vale_heap) (va_x_heap6:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 6
va_x_heap6 (va_upd_mem_heaplet 5 va_x_heap5 (va_upd_mem_heaplet 3 va_x_heap3
(va_upd_mem_heaplet 2 va_x_heap2 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 15 va_x_xmm15
(va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11
va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRbp va_x_rbp (va_upd_reg64
rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem
va_s0))))))))))))))))))))))))))))))))))))) in va_get_ok va_sM /\ (let
(abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_s0)) in Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet
1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\ Vale.X64.Decls.modifies_buffer128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) /\
Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32
/\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let
(ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in let
(plain_in:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in128_b)) in let (cipher_out:(seq quad32)) = va_if
(plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) (fun _ ->
FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM)
inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM)
out128_b)) in let (cipher_bound:nat) = va_if (plain_num_bytes > (len128x6 + len128)
`op_Multiply` 128 `op_Division` 8) (fun _ -> len128x6 + len128 + 1) (fun _ -> len128x6 +
len128) in Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2 /\ (let
(length_quad:quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8
`op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply` plain_num_bytes) 0) in let
(raw_auth_quads:(seq quad32)) = va_if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0
`op_Multiply` 128 `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_s0) abytes_b)) (fun _ -> Vale.X64.Decls.s128 (va_get_mem_heaplet 1
va_s0) auth_b) in let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice
#Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64
rRsi va_s0) in let (padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits
auth_input_bytes in let (auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32
padded_auth_bytes in let (raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32
(FStar.Seq.Base.append #quad32 auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in128x6_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in let (total_bytes:nat)
= FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in let
(raw_quad_seq:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> let (ab:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let (pb:(seq
nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) (fun
_ -> raw_quad_seq) in let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32
raw_quad_seq (FStar.Seq.Base.create #quad32 1 length_quad) in va_get_xmm 8 va_sM ==
Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg
key 0))) ==> va_k va_sM (())))
val va_wpProof_Gcm_blocks : alg:algorithm -> offset:int -> auth_b:buffer128 -> abytes_b:buffer128
-> in128x6_b:buffer128 -> out128x6_b:buffer128 -> in128_b:buffer128 -> out128_b:buffer128 ->
inout_b:buffer128 -> iv_b:buffer128 -> scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq
quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b
in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks alg offset) ([va_Mod_flags;
va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2;
va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm
11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15;
va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi;
va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b
iv_b scratch_b key round_keys keys_b hkeys_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_blocks (va_code_Gcm_blocks alg offset) va_s0 alg offset auth_b
abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b
hkeys_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM
(va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm
13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm
9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0))))))))))))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet
3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_blocks (alg:algorithm) (offset:int) (auth_b:buffer128) (abytes_b:buffer128)
(in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128) (out128_b:buffer128)
(inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Gcm_blocks alg
offset)) =
(va_QProc (va_code_Gcm_blocks alg offset) ([va_Mod_flags; va_Mod_mem_heaplet 6;
va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1;
va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;
va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64
rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64
rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64
rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_Gcm_blocks alg offset auth_b
abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b
hkeys_b) (va_wpProof_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b))
#pop-options
//--
//-- Gcm_blocks_wrapped
#push-options "--z3rlimit 60"
val va_code_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks_wrapped alg offset =
(va_Block (va_CCons (va_code_Gcm_blocks alg offset) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_Block (va_CNil ())) (va_CNil ())))))
val va_codegen_success_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks_wrapped alg offset =
(va_pbool_and (va_codegen_success_Gcm_blocks alg offset) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks_wrapped (va_mods:va_mods_t) (alg:algorithm) (offset:int) (auth_b:buffer128)
(abytes_b:buffer128) (in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128)
(out128_b:buffer128) (inout_b:buffer128) (iv_b:buffer128) (iv:supported_iv_LE)
(scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (expected_tag:(seq nat8)) : (va_quickCode unit (va_code_Gcm_blocks_wrapped
alg offset)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 0) (va_get_stack va_s) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 8) (va_get_stack va_s) in let
(out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 16) (va_get_stack va_s) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 24) (va_get_stack va_s) in let
(in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 32) (va_get_stack va_s) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 40) (va_get_stack va_s) in let
(len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset
+ 48) (va_get_stack va_s) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 56) (va_get_stack va_s) in let
(plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s
+ offset + 64) (va_get_stack va_s) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 739 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b
iv_b scratch_b key round_keys keys_b hkeys_b) (fun (va_s:va_state) _ -> va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 741 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(8 `op_Multiply` va_get_reg64 rRsi va_old_s >= 0 /\ 8 `op_Multiply` va_get_reg64 rRsi va_old_s
<= 18446744073709551615 /\ 8 `op_Multiply` plain_num_bytes >= 0 /\ 8 `op_Multiply`
plain_num_bytes <= 18446744073709551615) (fun _ -> let (va_arg55:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8
`op_Multiply` va_get_reg64 rRsi va_old_s) 1) (8 `op_Multiply` plain_num_bytes) 0) in let
(va_arg54:Vale.Def.Types_s.quad32) = va_get_xmm 8 va_s in let
(va_arg53:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s)) in let
(va_arg52:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2
va_old_s) in let (va_arg51:Vale.AES.GCM_s.supported_iv_LE) = iv in let (va_arg50:Prims.nat) =
va_get_reg64 rRsi va_old_s in let (va_arg49:Prims.nat) = plain_num_bytes in let
(va_arg48:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s) inout_b in let (va_arg47:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b in let
(va_arg46:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s) out128x6_b in let (va_arg45:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b in let
(va_arg44:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_old_s) in128_b in let (va_arg43:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in
let (va_arg42:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_old_s) abytes_b in let (va_arg41:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) auth_b in let
(va_arg40:(FStar.Seq.Base.seq Vale.Def.Words_s.nat32)) = key in let
(va_arg39:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 741 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCM.gcm_blocks_dec_helper_simplified va_arg39 va_arg40 va_arg41
va_arg42 va_arg43 va_arg44 va_arg45 va_arg46 va_arg47 va_arg48 va_arg49 va_arg50 va_arg51
va_arg52 va_arg53 va_arg54 va_arg55) (let (auth_raw_quads:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_old_s) auth_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_old_s)
abytes_b) in va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 751 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes auth_raw_quads) 0 (va_get_reg64
rRsi va_old_s)) (fun _ -> let (auth_bytes:(FStar.Seq.Base.seq Vale.Def.Types_s.nat8)) =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
auth_raw_quads) 0 (va_get_reg64 rRsi va_old_s) in let (va_arg38:Vale.Def.Types_s.quad32) =
Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_old_s) in let
(va_arg37:Vale.AES.GCM_s.supported_iv_LE) = iv in let (va_arg36:Prims.nat) = plain_num_bytes in
let (va_arg35:(FStar.Seq.Base.seq Vale.Def.Words_s.nat8)) = expected_tag in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Words_s.nat8)) = auth_bytes in let
(va_arg33:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s) inout_b in let (va_arg32:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b in let
(va_arg31:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s) out128x6_b in let (va_arg30:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b in let
(va_arg29:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_old_s) in128_b in let (va_arg28:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in
let (va_arg27:(FStar.Seq.Base.seq Vale.Def.Words_s.nat32)) = key in let
(va_arg26:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 752 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCM.gcm_blocks_helper_dec_simplified va_arg26 va_arg27 va_arg28
va_arg29 va_arg30 va_arg31 va_arg32 va_arg33 va_arg34 va_arg35 va_arg36 va_arg37 va_arg38)
(va_QEmpty (()))))))))
val va_lemma_Gcm_blocks_wrapped : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> offset:int ->
auth_b:buffer128 -> abytes_b:buffer128 -> in128x6_b:buffer128 -> out128x6_b:buffer128 ->
in128_b:buffer128 -> out128_b:buffer128 -> inout_b:buffer128 -> iv_b:buffer128 ->
iv:supported_iv_LE -> scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) ->
keys_b:buffer128 -> hkeys_b:buffer128 -> expected_tag:(seq nat8)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks_wrapped alg offset) va_s0 /\ va_get_ok
va_s0 /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64
rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in sse_enabled /\ movbe_enabled /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0)
Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp
va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet
1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2
va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6
va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1
va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3
va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b;
scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\
Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b;
out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b;
hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b;
out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b;
out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b
== out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b)
/\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr
+ 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\
in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64
/\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b ==
va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==
len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\
plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 <
pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0
va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\
12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128
(128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128
`op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\
(va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\
va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128
`op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))) /\ (let iv_BE =
Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let h_LE =
Vale.AES.AES_s.aes_encrypt_LE alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)
in iv_BE == Vale.AES.GCM_s.compute_iv_BE h_LE iv))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in Vale.X64.Decls.modifies_buffer128 out128_b
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128
iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\
Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3
va_sM) /\ Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0)
(va_get_mem_heaplet 5 va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b
(va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\
va_get_reg64 rRsi va_s0 < pow2_32 /\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0
(va_get_mem_heaplet 2 va_s0) in let auth_raw_quads = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_s0) abytes_b) in let auth_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
auth_raw_quads) 0 (va_get_reg64 rRsi va_s0) in let plain_raw_quads = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0)
in128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) in let plain_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
plain_raw_quads) 0 plain_num_bytes in let cipher_raw_quads = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM)
out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) in let cipher_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
cipher_raw_quads) 0 plain_num_bytes in l_and (l_and (l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.nat8 auth_bytes < pow2_32) (FStar.Seq.Base.length #Vale.Def.Types_s.nat8
plain_bytes < pow2_32)) (cipher_bytes == __proj__Mktuple2__item___1 #(FStar.Seq.Base.seq
Vale.Def.Types_s.nat8) #bool (Vale.AES.GCM_s.gcm_decrypt_LE alg
(Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv plain_bytes auth_bytes expected_tag)))
(Vale.Def.Types_s.le_quad32_to_bytes (va_get_xmm 8 va_sM) == Vale.AES.GCM.gcm_decrypt_LE_tag
alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv plain_bytes auth_bytes))) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM (va_update_mem_heaplet
5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_mem_heaplet 1
va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12
va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM
(va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRbp va_sM
(va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks_wrapped va_b0 va_s0 alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b iv scratch_b key round_keys keys_b hkeys_b expected_tag =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks_wrapped va_mods alg offset auth_b abytes_b in128x6_b out128x6_b
in128_b out128_b inout_b iv_b iv scratch_b key round_keys keys_b hkeys_b expected_tag in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks_wrapped alg offset) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 588 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64
(va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let
(in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in
let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in
let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in
let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 711 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 712 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 713 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 714 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 715 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet
6 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 718 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(plain_num_bytes < pow2_32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 719 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRsi va_s0 < pow2_32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 721 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 723 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let auth_raw_quads = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_s0)
abytes_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 724 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let auth_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes auth_raw_quads) 0 (va_get_reg64 rRsi va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 725 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let plain_raw_quads = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 726 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let plain_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes plain_raw_quads) 0 plain_num_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 727 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let cipher_raw_quads = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 728 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let cipher_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes cipher_raw_quads) 0 plain_num_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 737 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(l_and (l_and (l_and (FStar.Seq.Base.length #Vale.Def.Types_s.nat8 auth_bytes < pow2_32)
(FStar.Seq.Base.length #Vale.Def.Types_s.nat8 plain_bytes < pow2_32)) (cipher_bytes ==
__proj__Mktuple2__item___1 #(FStar.Seq.Base.seq Vale.Def.Types_s.nat8) #bool
(Vale.AES.GCM_s.gcm_decrypt_LE alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv
plain_bytes auth_bytes expected_tag))) (Vale.Def.Types_s.le_quad32_to_bytes (va_get_xmm 8
va_sM) == Vale.AES.GCM.gcm_decrypt_LE_tag alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE
key) iv plain_bytes auth_bytes))))))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet
3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_blocks_wrapped (alg:algorithm) (offset:int) (auth_b:buffer128) (abytes_b:buffer128)
(in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128) (out128_b:buffer128)
(inout_b:buffer128) (iv_b:buffer128) (iv:supported_iv_LE) (scratch_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (expected_tag:(seq nat8))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64
(va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let
(in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in
let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in
let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in
let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in
sse_enabled /\ movbe_enabled /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 +
offset + 0) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0)
Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 32) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 48) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 64) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) auth_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8 va_s0) iv_b 1
(va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6
va_s0) in128x6_ptr in128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6 va_s0) out128x6_ptr out128x6_b len128x6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1
va_s0) in128_ptr in128_b len128 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) out128_ptr out128_b len128
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5
va_s0) inout_ptr inout_b 1 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b;
scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\
Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b;
out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b;
hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b;
out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b;
out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b
== out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b)
/\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr
+ 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\
in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64
/\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b ==
va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==
len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\
plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 <
pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0
va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\
12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128
(128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128
`op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\
(va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\
va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128
`op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))) /\ (let iv_BE =
Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let h_LE =
Vale.AES.AES_s.aes_encrypt_LE alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)
in iv_BE == Vale.AES.GCM_s.compute_iv_BE h_LE iv)) /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) (va_x_rdi:nat64)
(va_x_rsi:nat64) (va_x_rbp:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64) (va_x_r15:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_xmm15:quad32) (va_x_heap1:vale_heap) (va_x_heap2:vale_heap)
(va_x_heap3:vale_heap) (va_x_heap5:vale_heap) (va_x_heap6:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 6
va_x_heap6 (va_upd_mem_heaplet 5 va_x_heap5 (va_upd_mem_heaplet 3 va_x_heap3
(va_upd_mem_heaplet 2 va_x_heap2 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 15 va_x_xmm15
(va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11
va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRbp va_x_rbp (va_upd_reg64
rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem
va_s0))))))))))))))))))))))))))))))))))))) in va_get_ok va_sM /\ (let
(abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in Vale.X64.Decls.modifies_buffer128 out128_b
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128
iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\
Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3
va_sM) /\ Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0)
(va_get_mem_heaplet 5 va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b
(va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\
va_get_reg64 rRsi va_s0 < pow2_32 /\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0
(va_get_mem_heaplet 2 va_s0) in let auth_raw_quads = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_s0) abytes_b) in let auth_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
auth_raw_quads) 0 (va_get_reg64 rRsi va_s0) in let plain_raw_quads = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0)
in128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) in let plain_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
plain_raw_quads) 0 plain_num_bytes in let cipher_raw_quads = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM)
out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) in let cipher_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
cipher_raw_quads) 0 plain_num_bytes in l_and (l_and (l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.nat8 auth_bytes < pow2_32) (FStar.Seq.Base.length #Vale.Def.Types_s.nat8
plain_bytes < pow2_32)) (cipher_bytes == __proj__Mktuple2__item___1 #(FStar.Seq.Base.seq
Vale.Def.Types_s.nat8) #bool (Vale.AES.GCM_s.gcm_decrypt_LE alg
(Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv plain_bytes auth_bytes expected_tag)))
(Vale.Def.Types_s.le_quad32_to_bytes (va_get_xmm 8 va_sM) == Vale.AES.GCM.gcm_decrypt_LE_tag
alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv plain_bytes auth_bytes))) ==> va_k
va_sM (())))
val va_wpProof_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> auth_b:buffer128 ->
abytes_b:buffer128 -> in128x6_b:buffer128 -> out128x6_b:buffer128 -> in128_b:buffer128 ->
out128_b:buffer128 -> inout_b:buffer128 -> iv_b:buffer128 -> iv:supported_iv_LE ->
scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> expected_tag:(seq nat8) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_blocks_wrapped alg offset auth_b abytes_b in128x6_b
out128x6_b in128_b out128_b inout_b iv_b iv scratch_b key round_keys keys_b hkeys_b
expected_tag va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks_wrapped alg offset)
([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3;
va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_blocks_wrapped alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b
inout_b iv_b iv scratch_b key round_keys keys_b hkeys_b expected_tag va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_blocks_wrapped (va_code_Gcm_blocks_wrapped alg offset) va_s0
alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b iv scratch_b key
round_keys keys_b hkeys_b expected_tag in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM
(va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm
13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm
9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0))))))))))))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet
3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_blocks_wrapped (alg:algorithm) (offset:int) (auth_b:buffer128)
(abytes_b:buffer128) (in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128)
(out128_b:buffer128) (inout_b:buffer128) (iv_b:buffer128) (iv:supported_iv_LE)
(scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (expected_tag:(seq nat8)) : (va_quickCode unit (va_code_Gcm_blocks_wrapped
alg offset)) =
(va_QProc (va_code_Gcm_blocks_wrapped alg offset) ([va_Mod_flags; va_Mod_mem_heaplet 6;
va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1;
va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;
va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64
rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64
rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64
rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_Gcm_blocks_wrapped alg offset
auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b iv scratch_b key round_keys
keys_b hkeys_b expected_tag) (va_wpProof_Gcm_blocks_wrapped alg offset auth_b abytes_b
in128x6_b out128x6_b in128_b out128_b inout_b iv_b iv scratch_b key round_keys keys_b hkeys_b
expected_tag))
#pop-options
//--
//-- Gcm_blocks_decrypt_stdcall
#push-options "--z3rlimit 1600" | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Lib.Basic.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.GHash.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESopt.fsti.checked",
"Vale.AES.X64.AESGCM.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.GCM.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GCMdecryptOpt.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Lib.Basic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 1600,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | win: Prims.bool -> alg: Vale.AES.AES_common_s.algorithm -> Vale.X64.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Decls.va_Block",
"Vale.X64.Decls.va_CCons",
"Vale.X64.InsMem.va_code_CreateHeaplets",
"Vale.X64.Decls.va_CNil",
"Vale.AES.X64.GCMencryptOpt.va_code_Save_registers",
"Vale.X64.InsBasic.va_code_Mov64",
"Vale.X64.Decls.va_op_dst_opr64_reg64",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Decls.va_op_opr64_reg64",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRsi",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rR8",
"Vale.X64.Machine_s.rR9",
"Vale.X64.InsStack.va_code_Load64_stack",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRsp",
"Prims.op_Addition",
"Vale.X64.Machine_s.rRbp",
"Vale.X64.Decls.va_code",
"Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_blocks_wrapped",
"Vale.X64.Decls.total_if",
"Prims.int",
"Vale.X64.Machine_s.rR15",
"Vale.X64.InsVector.va_code_Load128_buffer",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.InsVector.va_code_XmmEqual",
"Vale.X64.Machine_s.rRax",
"Vale.AES.X64.GCMencryptOpt.va_code_Restore_registers",
"Vale.X64.InsMem.va_code_DestroyHeaplets"
] | [] | false | false | false | true | false | let va_code_Gcm_blocks_decrypt_stdcall win alg =
| (va_Block (va_CCons (va_code_CreateHeaplets ())
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Save_registers win)
(va_CCons (if win
then
va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi)
(va_op_opr64_reg64 rRcx))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRsi)
(va_op_opr64_reg64 rRdx))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdx)
(va_op_opr64_reg64 rR8))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_op_opr64_reg64 rR9))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rR8
)
(va_op_reg_opr64_reg64 rRsp)
(224 + 40 + 0))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64
rR9)
(va_op_reg_opr64_reg64 rRsp)
(224 + 40 + 8))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64
rRbp)
(va_op_reg_opr64_reg64 rRsp)
(224 + 40 + 88))
(va_CNil ()))))))))
else
va_Block (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRbp)
(va_op_reg_opr64_reg64 rRsp)
(64 + 8 + 72))
(va_CNil ())))
(va_CCons (va_code_Gcm_blocks_wrapped alg
(Vale.X64.Decls.total_if #int win (224 + 56) (64 + 8)))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rR15)
(va_op_reg_opr64_reg64 rRsp)
(Vale.X64.Decls.total_if #int win (224 + 40 + 96) (64 + 8 + 80)))
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rR15)
0
Secret)
(va_CCons (va_code_XmmEqual (va_op_xmm_xmm 0) (va_op_xmm_xmm 8))
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_op_opr64_reg64 rRax))
(va_CCons (va_code_Restore_registers win)
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax
)
(va_op_opr64_reg64 rRcx))
(va_CCons (va_code_DestroyHeaplets ())
(va_CNil ())))))))))))))))) | false |
DM4F_layered5.fst | DM4F_layered5.lift_id_st | val lift_id_st (a wp st: _) (f: ID5.repr a wp) : repr a st (lift_id_st_wp wp) | val lift_id_st (a wp st: _) (f: ID5.repr a wp) : repr a st (lift_id_st_wp wp) | let lift_id_st a wp st (f : ID5.repr a wp)
: repr a st (lift_id_st_wp wp)
= fun s0 -> ID5.ID?.reflect (ID5.bind _ _ _ _ f (fun x -> ID5.return _ (x, s0))) | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 82,
"end_line": 114,
"start_col": 0,
"start_line": 112
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0)
unfold
let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)
let bind (a:Type) (b:Type) (st:Type0)
(wp_c : wp st a)
(wp_f : a -> wp st b)
(c : repr a st wp_c)
(f : (x:a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f)
= fun s0 ->
//let (y, s1) = c s0 in
//f y s1
// GM: argh! using the match above introduces noise in the VC, a true precondition
// that becomes a pain since we don't have monotonicity nor even extensionality
let r = c s0 in
f (fst r) (snd r)
let ite_wp #a #st (b:bool) (w1 w2 : wp st a) : wp st a =
fun s0 p -> (b ==> w1 s0 p) /\ ((~b) ==> w2 s0 p)
let if_then_else
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(f : repr a st wpf)
(g : repr a st wpg)
(b : bool)
: Type
= repr a st (ite_wp b wpf wpg)
let stronger
(#a:Type) (#st:Type0)
(w1 w2 : wp st a)
: Type0
= forall s0 p. w1 s0 p ==> w2 s0 p
let subcomp
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(#[@@@ refine] u : squash (stronger wpg wpf))
(f : repr a st wpf)
: repr a st wpg
= f
total
reifiable
reflectable
effect {
ST (a:Type) ([@@@ effect_param] st:Type0) (_:wp st a)
with {repr; return; bind; subcomp; if_then_else}
}
let lift_id_st_wp #a #st (w : ID5.wp a) : wp st a =
elim_pure_wp_monotonicity_forall ();
fun s0 p -> w (fun x -> p x s0) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> wp: ID5.wp a -> st: Type0 -> f: ID5.repr a wp
-> DM4F_layered5.repr a st (DM4F_layered5.lift_id_st_wp wp) | Prims.Tot | [
"total"
] | [] | [
"ID5.wp",
"ID5.repr",
"ID5.bind",
"FStar.Pervasives.Native.tuple2",
"ID5.return_wp",
"FStar.Pervasives.Native.Mktuple2",
"ID5.return",
"FStar.Monotonic.Pure.as_pure_wp",
"Prims.pure_post",
"DM4F_layered5.lift_id_st_wp",
"DM4F_Utils.curry",
"Prims.pure_pre",
"DM4F_layered5.repr"
] | [] | false | false | false | false | false | let lift_id_st a wp st (f: ID5.repr a wp) : repr a st (lift_id_st_wp wp) =
| fun s0 -> ID5.ID?.reflect (ID5.bind _ _ _ _ f (fun x -> ID5.return _ (x, s0))) | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.st_equiv_trans | val st_equiv_trans (#g: env) (#c0 #c1 #c2: comp) (d01: st_equiv g c0 c1) (d12: st_equiv g c1 c2)
: option (st_equiv g c0 c2) | val st_equiv_trans (#g: env) (#c0 #c1 #c2: comp) (d01: st_equiv g c0 c1) (d12: st_equiv g c1 c2)
: option (st_equiv g c0 c2) | let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)
: option (st_equiv g c0 c2)
=
match d01 with
| ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 -> (
let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in
if x = y && eq_tm (comp_res c0) (comp_res c1)
then Some (
ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing
(RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)
(VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)
(VE_Trans _ _ _ _ eq_post_01 eq_post_12)
)
else None
)
| ST_TotEquiv g t1 t2 u typing eq ->
let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in
let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in
Some (ST_TotEquiv g t1 t3 u typing eq'') | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 46,
"end_line": 238,
"start_col": 0,
"start_line": 220
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r
let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res)
let comp_st_with_post (c:comp_st) (post:term)
: c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } =
match c with
| C_ST st -> C_ST { st with post }
| C_STGhost st -> C_STGhost { st with post }
| C_STAtomic i obs st -> C_STAtomic i obs {st with post}
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | d01: Pulse.Typing.st_equiv g c0 c1 -> d12: Pulse.Typing.st_equiv g c1 c2
-> FStar.Pervasives.Native.option (Pulse.Typing.st_equiv g c0 c2) | Prims.Tot | [
"total"
] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.comp",
"Pulse.Typing.st_equiv",
"Pulse.Syntax.Base.comp_st",
"Pulse.Typing.st_equiv_pre",
"Pulse.Syntax.Base.var",
"Prims.l_and",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_None",
"Pulse.Syntax.Base.typ",
"Pulse.Typing.Env.lookup",
"Prims.l_not",
"FStar.Set.mem",
"Pulse.Syntax.Naming.freevars",
"Pulse.Syntax.Base.comp_post",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.comp_pre",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Syntax.Base.comp_res",
"Pulse.Syntax.Pure.tm_type",
"Pulse.Syntax.Base.comp_u",
"Pulse.Typing.Env.push_binding",
"Pulse.Syntax.Base.ppname_default",
"Pulse.Syntax.Naming.open_term",
"FStar.Reflection.Typing.equiv",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Typing.vprop_equiv",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"Prims.l_or",
"Pulse.Syntax.Base.eq_tm",
"FStar.Pervasives.Native.Some",
"Pulse.Typing.ST_VPropEquiv",
"FStar.Reflection.Typing.Rel_trans",
"FStar.Reflection.Typing.R_Eq",
"Pulse.Typing.VE_Trans",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.universe",
"Pulse.Typing.universe_of",
"FStar.Ghost.erased",
"Pulse.Typing.ST_TotEquiv",
"FStar.Ghost.hide",
"FStar.Ghost.reveal"
] | [] | false | false | false | false | false | let st_equiv_trans (#g: env) (#c0 #c1 #c2: comp) (d01: st_equiv g c0 c1) (d12: st_equiv g c1 c2)
: option (st_equiv g c0 c2) =
| match d01 with
| ST_VPropEquiv
_f
_c0
_c1
x
c0_pre_typing
c0_res_typing
c0_post_typing
eq_res_01
eq_pre_01
eq_post_01 ->
(let
ST_VPropEquiv
_f
_c1
_c2
y
c1_pre_typing
c1_res_typing
c1_post_typing
eq_res_12
eq_pre_12
eq_post_12 =
d12
in
if x = y && eq_tm (comp_res c0) (comp_res c1)
then
Some
(ST_VPropEquiv g
c0
c2
x
c0_pre_typing
c0_res_typing
c0_post_typing
(RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)
(VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)
(VE_Trans _ _ _ _ eq_post_01 eq_post_12))
else None)
| ST_TotEquiv g t1 t2 u typing eq ->
let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in
let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in
Some (ST_TotEquiv g t1 t3 u typing eq'') | false |
FStar.Bytes.fsti | FStar.Bytes.equal | val equal : b1: FStar.Bytes.bytes -> b2: FStar.Bytes.bytes -> Prims.logical | let equal b1 b2 =
length b1 = length b2 /\
(forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i]) | {
"file_name": "ulib/FStar.Bytes.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 86,
"end_line": 104,
"start_col": 0,
"start_line": 102
} | (*
Copyright 2008-2017 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.
*)
(*
A standard library for manipulation of value bytes.
This model is realized by Bytes.bytes in OCaml and by
struct {uintX_t size; char *bytes} (or similar) in C.
This file is essentially a specialized version of FStar.Seq,
with lemmas and refinements taylored for typical operations on
bytes, and with support for machine integers and C-extractible versions
(which Seq does not provide.)
@summary Value bytes standard library
*)
module FStar.Bytes
module S = FStar.Seq
module U = FStar.UInt
module U8 = FStar.UInt8
module U16 = FStar.UInt16
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Str = FStar.String
module Chr = FStar.Char
unfold let u8 = U8.t
unfold let u16 = U16.t
unfold let u32 = U32.t
(** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *)
unfold type byte = u8
(** Realized in C by a pair of a length field and uint8_t* in C
Realized in OCaml by a string *)
val bytes : t:Type0{hasEq t}
val len : bytes -> u32
unfold let length b = FStar.UInt32.v (len b)
(** representation for specs that need lemmas not defined here. *)
val reveal:
bytes
-> GTot (S.seq byte)
val length_reveal:
x:bytes
-> Lemma (ensures (S.length (reveal x) = length x))
[SMTPatOr [[SMTPat (S.length (reveal x))];
[SMTPat (len x)]]]
val hide:
s:S.seq byte{S.length s < pow2 32}
-> GTot bytes
val hide_reveal:
x:bytes
-> Lemma (ensures (hide (reveal x) = x))
[SMTPat (reveal x)]
val reveal_hide:
x:S.seq byte{S.length x < pow2 32}
-> Lemma (ensures (reveal (hide x) == x))
[SMTPat (hide x)]
type lbytes (l:nat) = b:bytes{length b = l}
type kbytes (k:nat) = b:bytes{length b < pow2 k}
let lbytes32 (l:UInt32.t) = b:bytes{len b = l}
val empty_bytes : lbytes 0
val empty_unique:
b:bytes
-> Lemma (length b = 0 ==> b = empty_bytes)
[SMTPat (len b)]
(** If you statically know the length, it is OK to read at arbitrary indexes *)
val get:
b:bytes
-> pos:u32{U32.v pos < length b}
-> Pure byte
(requires True)
(ensures (fun y -> y == S.index (reveal b) (U32.v pos)))
unfold let op_String_Access = get
unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.String.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.Char.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Bytes.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Char",
"short_module": "Chr"
},
{
"abbrev": true,
"full_module": "FStar.String",
"short_module": "Str"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b1: FStar.Bytes.bytes -> b2: FStar.Bytes.bytes -> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Bytes.bytes",
"Prims.l_and",
"Prims.b2t",
"Prims.op_Equality",
"FStar.UInt.uint_t",
"FStar.Bytes.length",
"Prims.l_Forall",
"FStar.Bytes.u32",
"Prims.op_LessThan",
"FStar.UInt32.v",
"Prims.eq2",
"FStar.Bytes.byte",
"FStar.Bytes.op_String_Access",
"Prims.logical"
] | [] | false | false | false | true | true | let equal b1 b2 =
| length b1 = length b2 /\
(forall (i: u32{U32.v i < length b1}). {:pattern (b1.[ i ]); (b2.[ i ])} b1.[ i ] == b2.[ i ]) | false |
|
Vale.AES.X64.GCMdecryptOpt.fst | Vale.AES.X64.GCMdecryptOpt.va_codegen_success_Gcm_blocks_decrypt_stdcall | val va_codegen_success_Gcm_blocks_decrypt_stdcall : win:bool -> alg:algorithm -> Tot va_pbool | val va_codegen_success_Gcm_blocks_decrypt_stdcall : win:bool -> alg:algorithm -> Tot va_pbool | let va_codegen_success_Gcm_blocks_decrypt_stdcall win alg =
(va_pbool_and (va_codegen_success_CreateHeaplets ()) (va_pbool_and
(va_codegen_success_Save_registers win) (va_pbool_and (if win then va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR8)) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rR8) (va_op_reg_opr64_reg64 rRsp) (224
+ 40 + 0)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rR9)
(va_op_reg_opr64_reg64 rRsp) (224 + 40 + 8)) (va_pbool_and (va_codegen_success_Load64_stack
(va_op_dst_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rRsp) (224 + 40 + 88)) (va_ttrue ())))))))
else va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRbp)
(va_op_reg_opr64_reg64 rRsp) (64 + 8 + 72)) (va_ttrue ())) (va_pbool_and
(va_codegen_success_Gcm_blocks_wrapped alg (Vale.X64.Decls.total_if #int win (224 + 56) (64 +
8))) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rR15)
(va_op_reg_opr64_reg64 rRsp) (Vale.X64.Decls.total_if #int win (224 + 40 + 96) (64 + 8 + 80)))
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm
0) (va_op_reg_opr64_reg64 rR15) 0 Secret) (va_pbool_and (va_codegen_success_XmmEqual
(va_op_xmm_xmm 0) (va_op_xmm_xmm 8)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRax)) (va_pbool_and
(va_codegen_success_Restore_registers win) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rRcx)) (va_pbool_and
(va_codegen_success_DestroyHeaplets ()) (va_ttrue ())))))))))))) | {
"file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 68,
"end_line": 1961,
"start_col": 0,
"start_line": 1939
} | module Vale.AES.X64.GCMdecryptOpt
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GCM
open Vale.AES.GHash_s
open Vale.AES.GHash
open Vale.AES.GCM_s
open Vale.AES.X64.AES
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.Poly1305.Math
open Vale.AES.GCM_helpers
open Vale.AES.X64.GHash
open Vale.AES.X64.GCTR
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsStack
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.X64.GF128_Mul
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2.Bits_s
open Vale.AES.X64.AESopt
open Vale.AES.X64.AESGCM
open Vale.AES.X64.AESopt2
open Vale.Lib.Meta
open Vale.AES.X64.GCMencryptOpt
open Vale.AES.OptPublic
open Vale.Lib.Basic
#reset-options "--z3rlimit 20 --max_ifuel 0"
//-- Gcm_extra_bytes
val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_extra_bytes alg =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0)
(va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor
(va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_CNil ()))))))))))
val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_extra_bytes alg =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and
(va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat)
(old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit
(va_code_Gcm_extra_bytes alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range
1 1)) = 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRax) 0 Secret inout_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let
(hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s)
inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key
round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax)
(va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (()))))))))))))))
val va_lemma_Gcm_extra_bytes : va_b0:va_code -> va_s0:va_state -> alg:algorithm ->
inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) ->
h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_extra_bytes alg) va_s0 /\ va_get_ok va_s0 /\ (let
(len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b
inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b
len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM
(va_update_mem va_sM va_s0))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_extra_bytes va_b0 va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes
old_hash completed_quads h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_extra_bytes va_mods alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_extra_bytes alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 121 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (len:(va_int_range 1 1)) = 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 177 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 181 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE old_hash input_quads)))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\
Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b
inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax
va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\ (forall
(va_x_mem:vale_heap) (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm10:quad32) (va_x_heap5:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 5
va_x_heap5 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7
(va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRcx va_x_rcx (va_upd_mem va_x_mem va_s0)))))))))))))) in va_get_ok
va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==> va_k va_sM (())))
val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat ->
old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags;
va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_extra_bytes (va_code_Gcm_extra_bytes alg) va_s0 alg inout_b key
round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10
va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_extra_bytes alg)) =
(va_QProc (va_code_Gcm_extra_bytes alg) ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem])
(va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE) (va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE))
//--
//-- Gcm_blocks128
val va_code_Gcm_blocks128 : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks128 alg =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_CCons
(va_code_Ghash_buffer ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi)
(va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdx)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Gctr_blocks128 alg) (va_CNil ())))))))))
val va_codegen_success_Gcm_blocks128 : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks128 alg =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Ghash_buffer ()) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Gctr_blocks128 alg) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks128 (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128)
(key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32)
: (va_quickCode unit (va_code_Gcm_blocks128 alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 274 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 275 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 277 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_buffer hkeys_b in_b h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_old_s))) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gctr_blocks128 alg in_b out_b key round_keys keys_b) (va_QEmpty (()))))))))))
val va_lemma_Gcm_blocks128 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 ->
out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks128 alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 10 va_sM (va_update_xmm 11 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR11 va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks128 va_b0 va_s0 alg in_b out_b key round_keys keys_b hkeys_b h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks128 va_mods alg in_b out_b key round_keys keys_b hkeys_b h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks128 alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 210 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 255 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 261 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 262 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx
va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 265 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) out_b)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 267 column 131 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==>
FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64) (va_x_rdi:nat64) (va_x_r11:nat64)
(va_x_r10:nat64) (va_x_rdx:nat64) (va_x_r12:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm11:quad32) (va_x_xmm10:quad32)
(va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64
rR10 va_x_r10 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRbx
va_x_rbx (va_upd_mem va_x_mem va_s0))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) ==> va_k va_sM (())))
val va_wpProof_Gcm_blocks128 : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> h_LE:quad32 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b
h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks128 alg) ([va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6;
va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0;
va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi;
va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_blocks128 (va_code_Gcm_blocks128 alg) va_s0 alg in_b out_b key
round_keys keys_b hkeys_b h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 10
va_sM (va_update_xmm 11 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2
va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR12 va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) : (va_quickCode
unit (va_code_Gcm_blocks128 alg)) =
(va_QProc (va_code_Gcm_blocks128 alg) ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10;
va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64
rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem])
(va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE)
(va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE))
//--
//-- Gcm_blocks
#push-options "--z3rlimit 1000"
val va_code_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks alg offset =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx))
(va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64
32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp)
(offset + 0)) (va_CCons (va_code_Gcm_blocks_auth ()) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_CCons
(va_code_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp)
(offset + 24)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rR8) 0 Public) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Load_one_lsb
(va_op_xmm_xmm 10)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_xmm_xmm 10)) (va_CCons (va_code_AES_GCM_decrypt_6mult alg) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64
rRbp) 32 Secret) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp)
(offset + 32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_CCons (va_code_Gcm_blocks128 alg)
(va_CCons (va_code_Stack_lemma ()) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rR14)
(va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public)) (va_CCons (va_code_IMul64
(va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_CCons (va_IfElse
(va_cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (va_Block (va_CCons
(va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (va_CCons
(va_code_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_CCons
(va_code_Gcm_extra_bytes alg) (va_CCons (va_Block (va_CNil ())) (va_CNil ()))))))) (va_Block
(va_CNil ()))) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15))
(va_CCons (va_code_Gcm_make_length_quad ()) (va_CCons (va_code_Ghash_register ()) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRbp) 0 Secret) (va_CCons (va_code_Gctr_register alg) (va_CCons (va_Block (va_CNil ()))
(va_CNil ()))))))))))))))))))))))))))))))))))))
val va_codegen_success_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks alg offset =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9)
(va_const_opr64 32)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64
rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0)) (va_pbool_and
(va_codegen_success_Gcm_blocks_auth ()) (va_pbool_and (va_codegen_success_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp)
(offset + 16)) (va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdx)
(va_op_reg_opr64_reg64 rRsp) (offset + 24)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64 rR8) 0 Public)
(va_pbool_and (va_codegen_success_Store128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_pbool_and
(va_codegen_success_Load_one_lsb (va_op_xmm_xmm 10)) (va_pbool_and (va_codegen_success_VPaddd
(va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_pbool_and
(va_codegen_success_AES_GCM_decrypt_6mult alg) (va_pbool_and (va_codegen_success_Load128_buffer
(va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRbp) 32 Secret)
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRax)
(va_op_reg_opr64_reg64 rRsp) (offset + 32)) (va_pbool_and (va_codegen_success_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp)
(offset + 48)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR14)
(va_op_opr64_reg64 rRdx)) (va_pbool_and (va_codegen_success_InitPshufbMask (va_op_xmm_xmm 9)
(va_op_reg_opr64_reg64 rR12)) (va_pbool_and (va_codegen_success_Pshufb (va_op_xmm_xmm 11)
(va_op_xmm_xmm 9)) (va_pbool_and (va_codegen_success_Gcm_blocks128 alg) (va_pbool_and
(va_codegen_success_Stack_lemma ()) (va_pbool_and (va_codegen_success_Add64
(va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public))
(va_pbool_and (va_codegen_success_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16))
(va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rR13)
(va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_pbool_and (va_pbool_and
(va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp)
(offset + 56)) (va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR10)
(va_op_opr64_reg64 rR13)) (va_pbool_and (va_codegen_success_And64 (va_op_dst_opr64_reg64 rR10)
(va_const_opr64 15)) (va_codegen_success_Gcm_extra_bytes alg)))) (va_pbool_and
(va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_pbool_and
(va_codegen_success_Gcm_make_length_quad ()) (va_pbool_and (va_codegen_success_Ghash_register
()) (va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_xmm_xmm 0) (va_op_reg_opr64_reg64 rRbp) 0 Secret) (va_pbool_and
(va_codegen_success_Gctr_register alg) (va_ttrue ()))))))))))))))))))))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks (va_mods:va_mods_t) (alg:algorithm) (offset:int) (auth_b:buffer128)
(abytes_b:buffer128) (in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128)
(out128_b:buffer128) (inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit
(va_code_Gcm_blocks alg offset)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 0) (va_get_stack va_s) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 8) (va_get_stack va_s) in let
(out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 16) (va_get_stack va_s) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 24) (va_get_stack va_s) in let
(in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 32) (va_get_stack va_s) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 40) (va_get_stack va_s) in let
(len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset
+ 48) (va_get_stack va_s) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 56) (va_get_stack va_s) in let
(plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s
+ offset + 64) (va_get_stack va_s) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_old_s)) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 463 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 464 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64 32))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 465 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp) (offset + 0))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 466 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_blocks_auth auth_b abytes_b hkeys_b h_LE) (fun (va_s:va_state)
(auth_quad_seq:(seq quad32)) -> let (y_0:quad32) = Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 0 in let (y_auth_bytes:quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 473 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 474 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 475 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 24))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 476 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 477 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> let
(iv_BE:Vale.X64.Decls.quad32) = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2
va_old_s) in let (ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32
iv_BE 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 483 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rR8) 0 Public iv_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 485 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_reg_opr64_reg64 rRbp)
(va_op_xmm_xmm 1) 0 Secret scratch_b 0) (fun (va_s:va_state) _ -> let (j0:quad32) = va_get_xmm
1 va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 487 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load_one_lsb (va_op_xmm_xmm 10)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 489 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1) (va_op_xmm_xmm 10)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 491 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AES_GCM_decrypt_6mult alg h_LE iv_b in128x6_b out128x6_b scratch_b key round_keys
keys_b hkeys_b) (fun (va_s:va_state) _ -> let (y_cipher128x6:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (auth_in:(seq quad32)) =
auth_quad_seq in let (va_arg138:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) =
Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in let
(va_arg137:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let
(va_arg136:Vale.Def.Types_s.quad32) = y_auth_bytes in let (va_arg135:Vale.Def.Types_s.quad32) =
y_0 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 494 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg135 va_arg136
y_cipher128x6 va_arg137 va_arg138) (let auth_in = FStar.Seq.Base.append #quad32 auth_in
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 498 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11)
(va_op_reg_opr64_reg64 rRbp) 32 Secret scratch_b 2) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 499 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 500 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 32))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 501 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 40))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 502 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 503 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 504 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 505 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 506 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_blocks128 alg in128_b out128_b key round_keys keys_b hkeys_b h_LE) (fun
(va_s:va_state) _ -> let (y_cipher128:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s) in let (va_arg134:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b in let
(va_arg133:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let
(va_arg132:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 508 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_ghash_incremental0_append h_LE va_arg132 y_cipher128x6
y_cipher128 va_arg133 va_arg134) (let auth_in = FStar.Seq.Base.append #quad32 auth_in
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 512 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Stack_lemma (va_op_reg64_reg64 rRsp) (offset + 24) Public) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 512 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Add64 (va_op_dst_opr64_reg64 rR14) (va_opr_code_Stack (va_op_reg64_reg64 rRsp)
(offset + 24) Public)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 513 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_IMul64 (va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 514 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64))
(fun (va_s:va_state) _ -> let (y_inout:Vale.Def.Types_s.quad32) = y_cipher128 in let
(plain_byte_seq:(seq quad32)) = empty_seq_quad32 in let (cipher_byte_seq:(seq quad32)) =
empty_seq_quad32 in let (va_arg131:Vale.Def.Types_s.quad32) = va_get_xmm 11 va_s in let
(va_arg130:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let
(va_arg129:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher_byte_seq in let
(va_arg128:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_byte_seq in let
(va_arg127:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 519 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_opaque_init va_arg127 va_arg128 va_arg129 va_arg130
va_arg131) (let (total_bytes:(va_int_at_least 0)) = FStar.Seq.Base.length #quad32 auth_quad_seq
`op_Multiply` 16 + plain_num_bytes in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 523 column 8 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_qIf va_mods (Cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (qblock va_mods (fun
(va_s:va_state) -> va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 525 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 526 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (fun (va_s:va_state) _
-> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 527 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.Poly1305.Math.lemma_poly_bits64 ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 528 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 532 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes y_0 auth_in
h_LE) (fun (va_s:va_state) _ -> let y_inout = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm
8 va_s) in let (raw_auth_quads:(FStar.Seq.Base.seq quad32)) = FStar.Seq.Base.append #quad32
auth_in (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b) in va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 536 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 total_bytes)
(fun _ -> let (auth_input_bytes:(FStar.Seq.Base.seq Vale.Def.Types_s.nat8)) =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
raw_auth_quads) 0 total_bytes in let (padded_auth_bytes:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let auth_in =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let plain_byte_seq =
Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b in let cipher_byte_seq =
Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QEmpty ((auth_in,
cipher_byte_seq, plain_byte_seq, y_inout)))))))))) (qblock va_mods (fun (va_s:va_state) ->
va_QEmpty ((auth_in, cipher_byte_seq, plain_byte_seq, y_inout))))) (fun (va_s:va_state) va_g ->
let ((auth_in:(seq quad32)), (cipher_byte_seq:(seq quad32)), (plain_byte_seq:(seq quad32)),
(y_inout:Vale.Def.Types_s.quad32)) = va_g in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 547 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 548 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_make_length_quad ()) (fun (va_s:va_state) _ -> let
(length_quad32:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 0
va_s) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 551 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_register hkeys_b h_LE y_inout) (fun (va_s:va_state) _ -> let
(y_final:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s)
in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 554 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRbp) 0 Secret scratch_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 557 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gctr_register alg key round_keys keys_b) (fun (va_s:va_state) _ -> let
(va_arg126:Vale.Def.Types_s.quad32) = va_get_xmm 8 va_s in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 560 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.Arch.Types.le_seq_quad32_to_bytes_of_singleton va_arg126)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
((fun (icb_BE_677:Vale.Def.Types_s.quad32) (plain_LE_678:Vale.Def.Types_s.quad32)
(alg_679:Vale.AES.AES_common_s.algorithm) (key_680:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32))
(i_681:Prims.int) -> Vale.AES.AES_s.is_aes_key_LE alg_679 key_680) j0 y_final alg key 0) (fun _
-> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 561 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 8 va_s == Vale.AES.GCTR_s.gctr_encrypt_block j0 y_final alg key 0) (let
(plain128:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in let
(cipher128:(FStar.Seq.Base.seq Vale.X64.Decls.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) in128_b) in va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 566 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.length #quad32 plain_byte_seq == 0 ==> FStar.Seq.Base.equal
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 plain128 plain_byte_seq)
plain128) (va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 567 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.length #quad32 cipher_byte_seq == 0 ==> FStar.Seq.Base.equal
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 cipher128 cipher_byte_seq)
cipher128) (let (va_arg125:Vale.Def.Types_s.quad32) = Vale.AES.GCTR.inc32lite ctr_BE_2 len128x6
in let (va_arg124:Vale.Def.Types_s.quad32) = ctr_BE_2 in let (va_arg123:(FStar.Seq.Base.seq
Vale.Def.Types_s.nat32)) = key in let (va_arg122:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32))
= Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b in let
(va_arg121:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_old_s) in128_b in let (va_arg120:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out128x6_b in let
(va_arg119:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_old_s) in128x6_b in let (va_arg118:Prims.nat) = len128 in let
(va_arg117:Prims.nat) = len128x6 in let (va_arg116:Vale.AES.AES_common_s.algorithm) = alg in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 569 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg116 va_arg117 va_arg118
va_arg119 va_arg120 va_arg121 va_arg122 va_arg123 va_arg124 va_arg125) (let
(va_arg115:Vale.Def.Types_s.quad32) = Vale.AES.GCTR.inc32lite (Vale.AES.GCTR.inc32lite ctr_BE_2
len128x6) len128 in let (va_arg114:Vale.Def.Types_s.quad32) = ctr_BE_2 in let
(va_arg113:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = key in let
(va_arg112:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = cipher_byte_seq in let
(va_arg111:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = plain_byte_seq in let
(va_arg110:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s) out128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b) in let
(va_arg109:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) in128_b) in let (va_arg108:Prims.nat) =
FStar.Seq.Base.length #quad32 plain_byte_seq in let (va_arg107:Prims.nat) = len128x6 + len128
in let (va_arg106:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 575 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.lemma_gctr_partial_append va_arg106 va_arg107 va_arg108
va_arg109 va_arg110 va_arg111 va_arg112 va_arg113 va_arg114 va_arg115) (let
(va_arg105:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = auth_in in let
(va_arg104:Vale.Def.Types_s.quad32) = y_0 in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 583 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.lemma_hash_append2 h_LE va_arg104 y_inout y_final va_arg105
length_quad32) (let auth_in = FStar.Seq.Base.append #quad32 auth_in (FStar.Seq.Base.create
#Vale.Def.Types_s.quad32 1 length_quad32) in let (va_arg103:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = auth_in in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 585 column 31 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GHash.ghash_incremental_to_ghash h_LE va_arg103) (va_QEmpty
(()))))))))))))))))))))))))))))))))))))))))))))))))
val va_lemma_Gcm_blocks : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> offset:int ->
auth_b:buffer128 -> abytes_b:buffer128 -> in128x6_b:buffer128 -> out128x6_b:buffer128 ->
in128_b:buffer128 -> out128_b:buffer128 -> inout_b:buffer128 -> iv_b:buffer128 ->
scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks alg offset) va_s0 /\ va_get_ok va_s0 /\
(let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_s0)) in sse_enabled /\ movbe_enabled /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0)
Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp
va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet
1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2
va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6
va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1
va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3
va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b;
scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\
Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b;
out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b;
hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b;
out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b;
out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b
== out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b)
/\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr
+ 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\
in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64
/\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b ==
va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==
len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\
plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 <
pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0
va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\
12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128
(128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128
`op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\
(va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\
va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128
`op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_s0)) in Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet
1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\ Vale.X64.Decls.modifies_buffer128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) /\
Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32
/\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let
(ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in let
(plain_in:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) else FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in128_b)) in let (cipher_out:(seq quad32)) = (if (plain_num_bytes
> (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM)
out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) else
FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM)
out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) in let
(cipher_bound:nat) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division`
8) then (len128x6 + len128 + 1) else (len128x6 + len128)) in Vale.AES.GCTR.gctr_partial alg
cipher_bound plain_in cipher_out key ctr_BE_2 /\ (let (length_quad:quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8
`op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply` plain_num_bytes) 0) in let
(raw_auth_quads:(seq quad32)) = (if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0
`op_Multiply` 128 `op_Division` 8) then FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_s0) abytes_b) else Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0)
auth_b) in let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64 rRsi va_s0) in let
(padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in let
(auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes in let
(raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32
auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b))
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in let (total_bytes:nat) =
FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in let
(raw_quad_seq:(seq quad32)) = (if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) then (let (ab:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let (pb:(seq
nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) else
raw_quad_seq) in let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 raw_quad_seq
(FStar.Seq.Base.create #quad32 1 length_quad) in va_get_xmm 8 va_sM ==
Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg
key 0))) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM
(va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm
13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm
9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0)))))))))))))))))))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks va_b0 va_s0 alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks va_mods alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks alg offset) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 283 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64
(va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let
(in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in
let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in
let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in
let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in
let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in label va_range1
"***** POSTCONDITION NOT MET AT line 396 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 397 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 398 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 399 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 400 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet
6 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 403 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(plain_num_bytes < pow2_32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 404 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRsi va_s0 < pow2_32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (ctr_BE_1:quad32) = iv_BE in label va_range1
"***** POSTCONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 412 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (plain_in:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in128_b)) in label va_range1
"***** POSTCONDITION NOT MET AT line 421 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (cipher_out:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_sM) out128_b)) in label va_range1
"***** POSTCONDITION NOT MET AT line 430 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (cipher_bound:nat) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> len128x6 + len128 + 1) (fun _ -> len128x6 + len128) in label
va_range1
"***** POSTCONDITION NOT MET AT line 434 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 438 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (length_quad:quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 0 0 0 0) (8 `op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply`
plain_num_bytes) 0) in label va_range1
"***** POSTCONDITION NOT MET AT line 440 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (raw_auth_quads:(seq quad32)) = va_if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0
`op_Multiply` 128 `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_s0) abytes_b)) (fun _ -> Vale.X64.Decls.s128 (va_get_mem_heaplet 1
va_s0) auth_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 444 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64 rRsi va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 445 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits auth_input_bytes in label
va_range1
"***** POSTCONDITION NOT MET AT line 446 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_auth_bytes
in label va_range1
"***** POSTCONDITION NOT MET AT line 448 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 (FStar.Seq.Base.append #quad32
auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b))
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 452 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (total_bytes:nat) = FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 +
plain_num_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 453 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (raw_quad_seq:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply`
128 `op_Division` 8) (fun _ -> let (ab:(seq nat8)) = FStar.Seq.Base.slice
#Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32
raw_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let
(pb:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32
pb) (fun _ -> raw_quad_seq) in label va_range1
"***** POSTCONDITION NOT MET AT line 460 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32 raw_quad_seq
(FStar.Seq.Base.create #quad32 1 length_quad) in label va_range1
"***** POSTCONDITION NOT MET AT line 461 column 106 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 8 va_sM == Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE
h_LE auth_quad_seq) alg key 0)))))))))))))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet
3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_blocks (alg:algorithm) (offset:int) (auth_b:buffer128) (abytes_b:buffer128)
(in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128) (out128_b:buffer128)
(inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit ->
Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64
(va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let
(in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in
let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in
let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in
let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in
let (h_LE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s0)) in sse_enabled /\
movbe_enabled /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0)
(va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64
(va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet
1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2
va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6
va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1
va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3
va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b;
scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\
Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b;
out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b;
hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b;
out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b;
out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b
== out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b)
/\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr
+ 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\
in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64
/\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b ==
va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==
len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\
plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 <
pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0
va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\
12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128
(128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128
`op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\
(va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\
va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128
`op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)))) /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) (va_x_rdi:nat64)
(va_x_rsi:nat64) (va_x_rbp:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64) (va_x_r15:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_xmm15:quad32) (va_x_heap1:vale_heap) (va_x_heap2:vale_heap)
(va_x_heap3:vale_heap) (va_x_heap5:vale_heap) (va_x_heap6:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 6
va_x_heap6 (va_upd_mem_heaplet 5 va_x_heap5 (va_upd_mem_heaplet 3 va_x_heap3
(va_upd_mem_heaplet 2 va_x_heap2 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 15 va_x_xmm15
(va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11
va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRbp va_x_rbp (va_upd_reg64
rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem
va_s0))))))))))))))))))))))))))))))))))))) in va_get_ok va_sM /\ (let
(abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2
(va_get_mem_heaplet 0 va_s0)) in Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet
1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128 iv_b
(va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\ Vale.X64.Decls.modifies_buffer128
scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3 va_sM) /\
Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0)
(va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32
/\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let
(ctr_BE_1:quad32) = iv_BE in let (ctr_BE_2:quad32) = Vale.AES.GCTR_s.inc32 iv_BE 1 in let
(plain_in:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in128_b)) in let (cipher_out:(seq quad32)) = va_if
(plain_num_bytes > (len128x6 + len128) `op_Multiply` 128 `op_Division` 8) (fun _ ->
FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM)
inout_b)) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM)
out128_b)) in let (cipher_bound:nat) = va_if (plain_num_bytes > (len128x6 + len128)
`op_Multiply` 128 `op_Division` 8) (fun _ -> len128x6 + len128 + 1) (fun _ -> len128x6 +
len128) in Vale.AES.GCTR.gctr_partial alg cipher_bound plain_in cipher_out key ctr_BE_2 /\ (let
(length_quad:quad32) = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8
`op_Multiply` va_get_reg64 rRsi va_s0) 1) (8 `op_Multiply` plain_num_bytes) 0) in let
(raw_auth_quads:(seq quad32)) = va_if (va_get_reg64 rRsi va_s0 > va_get_reg64 rRdx va_s0
`op_Multiply` 128 `op_Division` 8) (fun _ -> FStar.Seq.Base.append #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_s0) abytes_b)) (fun _ -> Vale.X64.Decls.s128 (va_get_mem_heaplet 1
va_s0) auth_b) in let (auth_input_bytes:(seq nat8)) = FStar.Seq.Base.slice
#Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_auth_quads) 0 (va_get_reg64
rRsi va_s0) in let (padded_auth_bytes:(seq nat8)) = Vale.AES.GCTR_s.pad_to_128_bits
auth_input_bytes in let (auth_quad_seq:(seq quad32)) = Vale.Def.Types_s.le_bytes_to_seq_quad32
padded_auth_bytes in let (raw_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32
(FStar.Seq.Base.append #quad32 auth_quad_seq (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0)
in128x6_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b) in let (total_bytes:nat)
= FStar.Seq.Base.length #quad32 auth_quad_seq `op_Multiply` 16 + plain_num_bytes in let
(raw_quad_seq:(seq quad32)) = va_if (plain_num_bytes > (len128x6 + len128) `op_Multiply` 128
`op_Division` 8) (fun _ -> let (ab:(seq nat8)) = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes (FStar.Seq.Base.append #quad32 raw_quad_seq
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b))) 0 total_bytes in let (pb:(seq
nat8)) = Vale.AES.GCTR_s.pad_to_128_bits ab in Vale.Def.Types_s.le_bytes_to_seq_quad32 pb) (fun
_ -> raw_quad_seq) in let (auth_quad_seq:(seq quad32)) = FStar.Seq.Base.append #quad32
raw_quad_seq (FStar.Seq.Base.create #quad32 1 length_quad) in va_get_xmm 8 va_sM ==
Vale.AES.GCTR_s.gctr_encrypt_block ctr_BE_1 (Vale.AES.GHash_s.ghash_LE h_LE auth_quad_seq) alg
key 0))) ==> va_k va_sM (())))
val va_wpProof_Gcm_blocks : alg:algorithm -> offset:int -> auth_b:buffer128 -> abytes_b:buffer128
-> in128x6_b:buffer128 -> out128x6_b:buffer128 -> in128_b:buffer128 -> out128_b:buffer128 ->
inout_b:buffer128 -> iv_b:buffer128 -> scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq
quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b
in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks alg offset) ([va_Mod_flags;
va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2;
va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm
11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15;
va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10;
va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi;
va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0
va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b
iv_b scratch_b key round_keys keys_b hkeys_b va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_blocks (va_code_Gcm_blocks alg offset) va_s0 alg offset auth_b
abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b
hkeys_b in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM
(va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm
13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm
9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0))))))))))))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet
3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_blocks (alg:algorithm) (offset:int) (auth_b:buffer128) (abytes_b:buffer128)
(in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128) (out128_b:buffer128)
(inout_b:buffer128) (iv_b:buffer128) (scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) : (va_quickCode unit (va_code_Gcm_blocks alg
offset)) =
(va_QProc (va_code_Gcm_blocks alg offset) ([va_Mod_flags; va_Mod_mem_heaplet 6;
va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1;
va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;
va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64
rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64
rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64
rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_Gcm_blocks alg offset auth_b
abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b scratch_b key round_keys keys_b
hkeys_b) (va_wpProof_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b scratch_b key round_keys keys_b hkeys_b))
#pop-options
//--
//-- Gcm_blocks_wrapped
#push-options "--z3rlimit 60"
val va_code_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks_wrapped alg offset =
(va_Block (va_CCons (va_code_Gcm_blocks alg offset) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_Block (va_CNil ())) (va_CNil ())))))
val va_codegen_success_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks_wrapped alg offset =
(va_pbool_and (va_codegen_success_Gcm_blocks alg offset) (va_ttrue ()))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks_wrapped (va_mods:va_mods_t) (alg:algorithm) (offset:int) (auth_b:buffer128)
(abytes_b:buffer128) (in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128)
(out128_b:buffer128) (inout_b:buffer128) (iv_b:buffer128) (iv:supported_iv_LE)
(scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (expected_tag:(seq nat8)) : (va_quickCode unit (va_code_Gcm_blocks_wrapped
alg offset)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 0) (va_get_stack va_s) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 8) (va_get_stack va_s) in let
(out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 16) (va_get_stack va_s) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 24) (va_get_stack va_s) in let
(in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s +
offset + 32) (va_get_stack va_s) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 40) (va_get_stack va_s) in let
(len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset
+ 48) (va_get_stack va_s) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s + offset + 56) (va_get_stack va_s) in let
(plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s
+ offset + 64) (va_get_stack va_s) in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 739 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gcm_blocks alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b
iv_b scratch_b key round_keys keys_b hkeys_b) (fun (va_s:va_state) _ -> va_qAssertSquash
va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 741 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(8 `op_Multiply` va_get_reg64 rRsi va_old_s >= 0 /\ 8 `op_Multiply` va_get_reg64 rRsi va_old_s
<= 18446744073709551615 /\ 8 `op_Multiply` plain_num_bytes >= 0 /\ 8 `op_Multiply`
plain_num_bytes <= 18446744073709551615) (fun _ -> let (va_arg55:Vale.Def.Types_s.quad32) =
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.Def.Types_s.insert_nat64
(Vale.Def.Types_s.insert_nat64 (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0) (8
`op_Multiply` va_get_reg64 rRsi va_old_s) 1) (8 `op_Multiply` plain_num_bytes) 0) in let
(va_arg54:Vale.Def.Types_s.quad32) = va_get_xmm 8 va_s in let
(va_arg53:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32
(Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem_heaplet 0 va_s)) in let
(va_arg52:Vale.Def.Types_s.quad32) = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2
va_old_s) in let (va_arg51:Vale.AES.GCM_s.supported_iv_LE) = iv in let (va_arg50:Prims.nat) =
va_get_reg64 rRsi va_old_s in let (va_arg49:Prims.nat) = plain_num_bytes in let
(va_arg48:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s) inout_b in let (va_arg47:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b in let
(va_arg46:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s) out128x6_b in let (va_arg45:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b in let
(va_arg44:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_old_s) in128_b in let (va_arg43:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in
let (va_arg42:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 7 va_old_s) abytes_b in let (va_arg41:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_old_s) auth_b in let
(va_arg40:(FStar.Seq.Base.seq Vale.Def.Words_s.nat32)) = key in let
(va_arg39:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 741 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCM.gcm_blocks_dec_helper_simplified va_arg39 va_arg40 va_arg41
va_arg42 va_arg43 va_arg44 va_arg45 va_arg46 va_arg47 va_arg48 va_arg49 va_arg50 va_arg51
va_arg52 va_arg53 va_arg54 va_arg55) (let (auth_raw_quads:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_old_s) auth_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_old_s)
abytes_b) in va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 751 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let
(j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908
j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))
Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes auth_raw_quads) 0 (va_get_reg64
rRsi va_old_s)) (fun _ -> let (auth_bytes:(FStar.Seq.Base.seq Vale.Def.Types_s.nat8)) =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
auth_raw_quads) 0 (va_get_reg64 rRsi va_old_s) in let (va_arg38:Vale.Def.Types_s.quad32) =
Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_old_s) in let
(va_arg37:Vale.AES.GCM_s.supported_iv_LE) = iv in let (va_arg36:Prims.nat) = plain_num_bytes in
let (va_arg35:(FStar.Seq.Base.seq Vale.Def.Words_s.nat8)) = expected_tag in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Words_s.nat8)) = auth_bytes in let
(va_arg33:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s) inout_b in let (va_arg32:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s) out128_b in let
(va_arg31:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s) out128x6_b in let (va_arg30:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_old_s) inout_b in let
(va_arg29:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_old_s) in128_b in let (va_arg28:(FStar.Seq.Base.seq
Vale.Def.Types_s.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_old_s) in128x6_b in
let (va_arg27:(FStar.Seq.Base.seq Vale.Def.Words_s.nat32)) = key in let
(va_arg26:Vale.AES.AES_common_s.algorithm) = alg in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 752 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCM.gcm_blocks_helper_dec_simplified va_arg26 va_arg27 va_arg28
va_arg29 va_arg30 va_arg31 va_arg32 va_arg33 va_arg34 va_arg35 va_arg36 va_arg37 va_arg38)
(va_QEmpty (()))))))))
val va_lemma_Gcm_blocks_wrapped : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> offset:int ->
auth_b:buffer128 -> abytes_b:buffer128 -> in128x6_b:buffer128 -> out128x6_b:buffer128 ->
in128_b:buffer128 -> out128_b:buffer128 -> inout_b:buffer128 -> iv_b:buffer128 ->
iv:supported_iv_LE -> scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) ->
keys_b:buffer128 -> hkeys_b:buffer128 -> expected_tag:(seq nat8)
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks_wrapped alg offset) va_s0 /\ va_get_ok
va_s0 /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64
rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in sse_enabled /\ movbe_enabled /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0)
Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp
va_s0 + offset + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet
1 va_s0) (va_get_reg64 rRdi va_s0) auth_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2
va_s0) (va_get_reg64 rR8 va_s0) iv_b 1 (va_get_mem_layout va_s0) Public /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6 va_s0) in128x6_ptr in128x6_b len128x6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6
va_s0) out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) in128_ptr in128_b len128
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1
va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) inout_ptr inout_b 1
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 3
va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0) hkeys_b 8
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b;
scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\
Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b;
out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b;
hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b;
out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b;
out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b
== out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b)
/\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr
+ 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\
in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64
/\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b ==
va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==
len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\
plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 <
pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0
va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\
12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128
(128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128
`op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\
(va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\
va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128
`op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))) /\ (let iv_BE =
Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let h_LE =
Vale.AES.AES_s.aes_encrypt_LE alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)
in iv_BE == Vale.AES.GCM_s.compute_iv_BE h_LE iv))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in Vale.X64.Decls.modifies_buffer128 out128_b
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128
iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\
Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3
va_sM) /\ Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0)
(va_get_mem_heaplet 5 va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b
(va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\
va_get_reg64 rRsi va_s0 < pow2_32 /\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0
(va_get_mem_heaplet 2 va_s0) in let auth_raw_quads = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_s0) abytes_b) in let auth_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
auth_raw_quads) 0 (va_get_reg64 rRsi va_s0) in let plain_raw_quads = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0)
in128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) in let plain_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
plain_raw_quads) 0 plain_num_bytes in let cipher_raw_quads = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM)
out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) in let cipher_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
cipher_raw_quads) 0 plain_num_bytes in l_and (l_and (l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.nat8 auth_bytes < pow2_32) (FStar.Seq.Base.length #Vale.Def.Types_s.nat8
plain_bytes < pow2_32)) (cipher_bytes == __proj__Mktuple2__item___1 #(FStar.Seq.Base.seq
Vale.Def.Types_s.nat8) #bool (Vale.AES.GCM_s.gcm_decrypt_LE alg
(Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv plain_bytes auth_bytes expected_tag)))
(Vale.Def.Types_s.le_quad32_to_bytes (va_get_xmm 8 va_sM) == Vale.AES.GCM.gcm_decrypt_LE_tag
alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv plain_bytes auth_bytes))) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM (va_update_mem_heaplet
5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_mem_heaplet 1
va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12
va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM
(va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRbp va_sM
(va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM
(va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks_wrapped va_b0 va_s0 alg offset auth_b abytes_b in128x6_b out128x6_b in128_b
out128_b inout_b iv_b iv scratch_b key round_keys keys_b hkeys_b expected_tag =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5;
va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14;
va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;
va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp;
va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks_wrapped va_mods alg offset auth_b abytes_b in128x6_b out128x6_b
in128_b out128_b inout_b iv_b iv scratch_b key round_keys keys_b hkeys_b expected_tag in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks_wrapped alg offset) va_qc
va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 588 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64
(va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let
(in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in
let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in
let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in
let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in
label va_range1
"***** POSTCONDITION NOT MET AT line 711 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out128_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 712 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 713 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 714 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 715 column 58 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out128x6_b (va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet
6 va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 718 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(plain_num_bytes < pow2_32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 719 column 38 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRsi va_s0 < pow2_32) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 721 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 723 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let auth_raw_quads = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) auth_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_s0)
abytes_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 724 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let auth_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes auth_raw_quads) 0 (va_get_reg64 rRsi va_s0) in label
va_range1
"***** POSTCONDITION NOT MET AT line 725 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let plain_raw_quads = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_s0) in128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 726 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let plain_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes plain_raw_quads) 0 plain_num_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 727 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let cipher_raw_quads = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 6 va_sM) out128x6_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out128_b)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 728 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let cipher_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes cipher_raw_quads) 0 plain_num_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 737 column 52 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(l_and (l_and (l_and (FStar.Seq.Base.length #Vale.Def.Types_s.nat8 auth_bytes < pow2_32)
(FStar.Seq.Base.length #Vale.Def.Types_s.nat8 plain_bytes < pow2_32)) (cipher_bytes ==
__proj__Mktuple2__item___1 #(FStar.Seq.Base.seq Vale.Def.Types_s.nat8) #bool
(Vale.AES.GCM_s.gcm_decrypt_LE alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv
plain_bytes auth_bytes expected_tag))) (Vale.Def.Types_s.le_quad32_to_bytes (va_get_xmm 8
va_sM) == Vale.AES.GCM.gcm_decrypt_LE_tag alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE
key) iv plain_bytes auth_bytes))))))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet
3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_blocks_wrapped (alg:algorithm) (offset:int) (auth_b:buffer128) (abytes_b:buffer128)
(in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128) (out128_b:buffer128)
(inout_b:buffer128) (iv_b:buffer128) (iv:supported_iv_LE) (scratch_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (expected_tag:(seq nat8))
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let (abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64
(va_get_reg64 rRsp va_s0 + offset + 0) (va_get_stack va_s0) in let
(in128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 8) (va_get_stack va_s0) in let (out128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 16) (va_get_stack va_s0) in
let (len128x6:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 24) (va_get_stack va_s0) in let (in128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 32) (va_get_stack va_s0) in
let (out128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 40) (va_get_stack va_s0) in let (len128:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 48) (va_get_stack va_s0) in
let (inout_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 56) (va_get_stack va_s0) in let (plain_num_bytes:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 64) (va_get_stack va_s0) in
sse_enabled /\ movbe_enabled /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 +
offset + 0) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0)
Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 32) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 48) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack
va_s0) Public (va_get_stackTaint va_s0) /\ Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64
rRsp va_s0 + offset + 64) (va_get_stack va_s0) Public (va_get_stackTaint va_s0) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) auth_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 7 va_s0) abytes_ptr abytes_b 1 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 2 va_s0) (va_get_reg64 rR8 va_s0) iv_b 1
(va_get_mem_layout va_s0) Public /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 6
va_s0) in128x6_ptr in128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 6 va_s0) out128x6_ptr out128x6_b len128x6
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1
va_s0) in128_ptr in128_b len128 (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) out128_ptr out128_b len128
(va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5
va_s0) inout_ptr inout_b 1 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.validDstAddrs128
(va_get_mem_heaplet 3 va_s0) (va_get_reg64 rRbp va_s0) scratch_b 9 (va_get_mem_layout va_s0)
Secret /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0)
hkeys_b 8 (va_get_mem_layout va_s0) Secret /\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b;
scratch_b; in128x6_b; out128x6_b; hkeys_b; in128_b; out128_b; inout_b]) /\
Vale.X64.Decls.buffer_disjoints128 scratch_b ([keys_b; in128x6_b; out128x6_b; in128_b;
out128_b; inout_b; hkeys_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b;
hkeys_b; in128_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; hkeys_b;
out128x6_b; inout_b]) /\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; hkeys_b;
out128x6_b; out128_b]) /\ (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \/ in128x6_b
== out128x6_b) /\ (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \/ in128_b == out128_b)
/\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ in128x6_ptr
+ 16 `op_Multiply` len128x6 < pow2_64 /\ out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\
in128_ptr + 16 `op_Multiply` len128 < pow2_64 /\ out128_ptr + 16 `op_Multiply` len128 < pow2_64
/\ inout_ptr + 16 < pow2_64 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b ==
va_get_reg64 rRdx va_s0 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1
/\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 out128_b /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128
in128x6_b == len128x6 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==
len128 /\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\
plain_num_bytes < pow2_32 /\ va_get_reg64 rRsi va_s0 < pow2_32 /\ va_get_reg64 rR9 va_s0 + 32 <
pow2_64 /\ Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem_heaplet 0
va_s0) + 128 < pow2_64 /\ len128x6 `op_Modulus` 6 == 0 /\ (len128x6 > 0 ==> len128x6 >= 6) /\
12 + len128x6 + 6 < pow2_32 /\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128
(128 `op_Division` 8) <= plain_num_bytes /\ plain_num_bytes < va_mul_nat len128x6 (128
`op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\
(va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) <= va_get_reg64 rRsi va_s0 /\
va_get_reg64 rRsi va_s0 < va_mul_nat (va_get_reg64 rRdx va_s0) (128 `op_Division` 8) + 128
`op_Division` 8) /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rRcx va_s0)
(va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key
(Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))) /\ (let iv_BE =
Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem_heaplet 2 va_s0) in let h_LE =
Vale.AES.AES_s.aes_encrypt_LE alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)
in iv_BE == Vale.AES.GCM_s.compute_iv_BE h_LE iv)) /\ (forall (va_x_mem:vale_heap)
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) (va_x_rdi:nat64)
(va_x_rsi:nat64) (va_x_rbp:nat64) (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64)
(va_x_r11:nat64) (va_x_r12:nat64) (va_x_r13:nat64) (va_x_r14:nat64) (va_x_r15:nat64)
(va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)
(va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32)
(va_x_xmm10:quad32) (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32)
(va_x_xmm14:quad32) (va_x_xmm15:quad32) (va_x_heap1:vale_heap) (va_x_heap2:vale_heap)
(va_x_heap3:vale_heap) (va_x_heap5:vale_heap) (va_x_heap6:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 6
va_x_heap6 (va_upd_mem_heaplet 5 va_x_heap5 (va_upd_mem_heaplet 3 va_x_heap3
(va_upd_mem_heaplet 2 va_x_heap2 (va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 15 va_x_xmm15
(va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12 (va_upd_xmm 11
va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8
(va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4
(va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0
(va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13
(va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10
(va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRbp va_x_rbp (va_upd_reg64
rRsi va_x_rsi (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax (va_upd_mem va_x_mem
va_s0))))))))))))))))))))))))))))))))))))) in va_get_ok va_sM /\ (let
(abytes_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 0) (va_get_stack va_s0) in let (in128x6_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 8) (va_get_stack va_s0) in
let (out128x6_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 16) (va_get_stack va_s0) in let (len128x6:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 24) (va_get_stack va_s0) in
let (in128_ptr:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0
+ offset + 32) (va_get_stack va_s0) in let (out128_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 40) (va_get_stack va_s0) in
let (len128:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +
offset + 48) (va_get_stack va_s0) in let (inout_ptr:Vale.X64.Memory.nat64) =
Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + offset + 56) (va_get_stack va_s0) in
let (plain_num_bytes:Vale.X64.Memory.nat64) = Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp
va_s0 + offset + 64) (va_get_stack va_s0) in Vale.X64.Decls.modifies_buffer128 out128_b
(va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1 va_sM) /\ Vale.X64.Decls.modifies_buffer128
iv_b (va_get_mem_heaplet 2 va_s0) (va_get_mem_heaplet 2 va_sM) /\
Vale.X64.Decls.modifies_buffer128 scratch_b (va_get_mem_heaplet 3 va_s0) (va_get_mem_heaplet 3
va_sM) /\ Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0)
(va_get_mem_heaplet 5 va_sM) /\ Vale.X64.Decls.modifies_buffer128 out128x6_b
(va_get_mem_heaplet 6 va_s0) (va_get_mem_heaplet 6 va_sM) /\ plain_num_bytes < pow2_32 /\
va_get_reg64 rRsi va_s0 < pow2_32 /\ (let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0
(va_get_mem_heaplet 2 va_s0) in let auth_raw_quads = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) auth_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 7 va_s0) abytes_b) in let auth_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
auth_raw_quads) 0 (va_get_reg64 rRsi va_s0) in let plain_raw_quads = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_s0) in128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0)
in128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) in let plain_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
plain_raw_quads) 0 plain_num_bytes in let cipher_raw_quads = FStar.Seq.Base.append
#Vale.X64.Decls.quad32 (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 6 va_sM) out128x6_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM)
out128_b)) (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) in let cipher_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes
cipher_raw_quads) 0 plain_num_bytes in l_and (l_and (l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.nat8 auth_bytes < pow2_32) (FStar.Seq.Base.length #Vale.Def.Types_s.nat8
plain_bytes < pow2_32)) (cipher_bytes == __proj__Mktuple2__item___1 #(FStar.Seq.Base.seq
Vale.Def.Types_s.nat8) #bool (Vale.AES.GCM_s.gcm_decrypt_LE alg
(Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv plain_bytes auth_bytes expected_tag)))
(Vale.Def.Types_s.le_quad32_to_bytes (va_get_xmm 8 va_sM) == Vale.AES.GCM.gcm_decrypt_LE_tag
alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv plain_bytes auth_bytes))) ==> va_k
va_sM (())))
val va_wpProof_Gcm_blocks_wrapped : alg:algorithm -> offset:int -> auth_b:buffer128 ->
abytes_b:buffer128 -> in128x6_b:buffer128 -> out128x6_b:buffer128 -> in128_b:buffer128 ->
out128_b:buffer128 -> inout_b:buffer128 -> iv_b:buffer128 -> iv:supported_iv_LE ->
scratch_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> expected_tag:(seq nat8) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_blocks_wrapped alg offset auth_b abytes_b in128x6_b
out128x6_b in128_b out128_b inout_b iv_b iv scratch_b key round_keys keys_b hkeys_b
expected_tag va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks_wrapped alg offset)
([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3;
va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_blocks_wrapped alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b
inout_b iv_b iv scratch_b key round_keys keys_b hkeys_b expected_tag va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_blocks_wrapped (va_code_Gcm_blocks_wrapped alg offset) va_s0
alg offset auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b iv scratch_b key
round_keys keys_b hkeys_b expected_tag in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 6 va_sM
(va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm
13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm
9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM
(va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM
(va_update_reg64 rRbp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM
va_s0))))))))))))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 6; va_Mod_mem_heaplet 5; va_Mod_mem_heaplet
3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13;
va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm
0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64
rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRbp; va_Mod_reg64
rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64
rRax; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_blocks_wrapped (alg:algorithm) (offset:int) (auth_b:buffer128)
(abytes_b:buffer128) (in128x6_b:buffer128) (out128x6_b:buffer128) (in128_b:buffer128)
(out128_b:buffer128) (inout_b:buffer128) (iv_b:buffer128) (iv:supported_iv_LE)
(scratch_b:buffer128) (key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128)
(hkeys_b:buffer128) (expected_tag:(seq nat8)) : (va_quickCode unit (va_code_Gcm_blocks_wrapped
alg offset)) =
(va_QProc (va_code_Gcm_blocks_wrapped alg offset) ([va_Mod_flags; va_Mod_mem_heaplet 6;
va_Mod_mem_heaplet 5; va_Mod_mem_heaplet 3; va_Mod_mem_heaplet 2; va_Mod_mem_heaplet 1;
va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;
va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64
rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64
rR8; va_Mod_reg64 rRbp; va_Mod_reg64 rRsi; va_Mod_reg64 rRdi; va_Mod_reg64 rRdx; va_Mod_reg64
rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_Gcm_blocks_wrapped alg offset
auth_b abytes_b in128x6_b out128x6_b in128_b out128_b inout_b iv_b iv scratch_b key round_keys
keys_b hkeys_b expected_tag) (va_wpProof_Gcm_blocks_wrapped alg offset auth_b abytes_b
in128x6_b out128x6_b in128_b out128_b inout_b iv_b iv scratch_b key round_keys keys_b hkeys_b
expected_tag))
#pop-options
//--
//-- Gcm_blocks_decrypt_stdcall
#push-options "--z3rlimit 1600"
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks_decrypt_stdcall win alg =
(va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Save_registers win) (va_CCons (if win then va_Block (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR8)) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rR8) (va_op_reg_opr64_reg64 rRsp) (224 + 40 + 0)) (va_CCons
(va_code_Load64_stack (va_op_dst_opr64_reg64 rR9) (va_op_reg_opr64_reg64 rRsp) (224 + 40 + 8))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rRsp) (224
+ 40 + 88)) (va_CNil ())))))))) else va_Block (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rRbp) (va_op_reg_opr64_reg64 rRsp) (64 + 8 + 72)) (va_CNil ())))
(va_CCons (va_code_Gcm_blocks_wrapped alg (Vale.X64.Decls.total_if #int win (224 + 56) (64 +
8))) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rR15) (va_op_reg_opr64_reg64 rRsp)
(Vale.X64.Decls.total_if #int win (224 + 40 + 96) (64 + 8 + 80))) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 0) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rR15) 0 Secret) (va_CCons (va_code_XmmEqual (va_op_xmm_xmm 0) (va_op_xmm_xmm 8)) (va_CCons
(va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rRax)) (va_CCons (va_code_Restore_registers
win) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRax) (va_op_opr64_reg64 rRcx)) (va_CCons
(va_code_DestroyHeaplets ()) (va_CNil ())))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Lib.Basic.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.GHash.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESopt.fsti.checked",
"Vale.AES.X64.AESGCM.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.GCM.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GCMdecryptOpt.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Lib.Basic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 1600,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | win: Prims.bool -> alg: Vale.AES.AES_common_s.algorithm -> Vale.X64.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Decls.va_pbool_and",
"Vale.X64.InsMem.va_codegen_success_CreateHeaplets",
"Vale.AES.X64.GCMencryptOpt.va_codegen_success_Save_registers",
"Vale.X64.InsBasic.va_codegen_success_Mov64",
"Vale.X64.Decls.va_op_dst_opr64_reg64",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Decls.va_op_opr64_reg64",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRsi",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rR8",
"Vale.X64.Machine_s.rR9",
"Vale.X64.InsStack.va_codegen_success_Load64_stack",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRsp",
"Prims.op_Addition",
"Vale.X64.Machine_s.rRbp",
"Vale.X64.Decls.va_ttrue",
"Vale.X64.Decls.va_pbool",
"Vale.AES.X64.GCMdecryptOpt.va_codegen_success_Gcm_blocks_wrapped",
"Vale.X64.Decls.total_if",
"Prims.int",
"Vale.X64.Machine_s.rR15",
"Vale.X64.InsVector.va_codegen_success_Load128_buffer",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.InsVector.va_codegen_success_XmmEqual",
"Vale.X64.Machine_s.rRax",
"Vale.AES.X64.GCMencryptOpt.va_codegen_success_Restore_registers",
"Vale.X64.InsMem.va_codegen_success_DestroyHeaplets"
] | [] | false | false | false | true | false | let va_codegen_success_Gcm_blocks_decrypt_stdcall win alg =
| (va_pbool_and (va_codegen_success_CreateHeaplets ())
(va_pbool_and (va_codegen_success_Save_registers win)
(va_pbool_and (if win
then
va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi)
(va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRsi)
(va_op_opr64_reg64 rRdx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdx)
(va_op_opr64_reg64 rR8))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_op_opr64_reg64 rR9))
(va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rR8
)
(va_op_reg_opr64_reg64 rRsp)
(224 + 40 + 0))
(va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64
rR9)
(va_op_reg_opr64_reg64 rRsp)
(224 + 40 + 8))
(va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64
rRbp)
(va_op_reg_opr64_reg64 rRsp)
(224 + 40 + 88))
(va_ttrue ())))))))
else
va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rRbp)
(va_op_reg_opr64_reg64 rRsp)
(64 + 8 + 72))
(va_ttrue ()))
(va_pbool_and (va_codegen_success_Gcm_blocks_wrapped alg
(Vale.X64.Decls.total_if #int win (224 + 56) (64 + 8)))
(va_pbool_and (va_codegen_success_Load64_stack (va_op_dst_opr64_reg64 rR15)
(va_op_reg_opr64_reg64 rRsp)
(Vale.X64.Decls.total_if #int win (224 + 40 + 96) (64 + 8 + 80)))
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 0)
(va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rR15)
0
Secret)
(va_pbool_and (va_codegen_success_XmmEqual (va_op_xmm_xmm 0)
(va_op_xmm_xmm 8))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Restore_registers win)
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRax
)
(va_op_opr64_reg64 rRcx))
(va_pbool_and (va_codegen_success_DestroyHeaplets ())
(va_ttrue ())))))))))))) | false |
DM4F_layered5.fst | DM4F_layered5.main | val main : Prims.unit | let main =
let r, n = reify (reify (add_via_state 1 2) 3) (Ghost.hide (fun _ -> True)) () in
FStar.IO.print_string (FStar.Printf.sprintf "%d:%d\n" r n) | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 60,
"end_line": 147,
"start_col": 0,
"start_line": 145
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0)
unfold
let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)
let bind (a:Type) (b:Type) (st:Type0)
(wp_c : wp st a)
(wp_f : a -> wp st b)
(c : repr a st wp_c)
(f : (x:a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f)
= fun s0 ->
//let (y, s1) = c s0 in
//f y s1
// GM: argh! using the match above introduces noise in the VC, a true precondition
// that becomes a pain since we don't have monotonicity nor even extensionality
let r = c s0 in
f (fst r) (snd r)
let ite_wp #a #st (b:bool) (w1 w2 : wp st a) : wp st a =
fun s0 p -> (b ==> w1 s0 p) /\ ((~b) ==> w2 s0 p)
let if_then_else
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(f : repr a st wpf)
(g : repr a st wpg)
(b : bool)
: Type
= repr a st (ite_wp b wpf wpg)
let stronger
(#a:Type) (#st:Type0)
(w1 w2 : wp st a)
: Type0
= forall s0 p. w1 s0 p ==> w2 s0 p
let subcomp
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(#[@@@ refine] u : squash (stronger wpg wpf))
(f : repr a st wpf)
: repr a st wpg
= f
total
reifiable
reflectable
effect {
ST (a:Type) ([@@@ effect_param] st:Type0) (_:wp st a)
with {repr; return; bind; subcomp; if_then_else}
}
let lift_id_st_wp #a #st (w : ID5.wp a) : wp st a =
elim_pure_wp_monotonicity_forall ();
fun s0 p -> w (fun x -> p x s0)
let lift_id_st a wp st (f : ID5.repr a wp)
: repr a st (lift_id_st_wp wp)
= fun s0 -> ID5.ID?.reflect (ID5.bind _ _ _ _ f (fun x -> ID5.return _ (x, s0)))
sub_effect ID ~> ST = lift_id_st
let null #st #a : wp st a =
fun s0 p -> forall x s1. p x s1
let get #st () : ST st st (fun s0 p -> p s0 s0) =
ST?.reflect (fun s0 -> (s0, s0))
let put #st (s:st) : ST unit st (fun _ p -> p () s) =
ST?.reflect (fun _ -> ((), s))
// this now works!!!
let test () : ST int int null =
let x = get () in
put (x + x);
get () + get ()
let addx (x:int) : ST unit int (fun s0 p -> p () (s0+x)) =
let y = get () in
put (x+y)
let add_via_state (x y : int) : ST int int (fun s0 p -> p (x+y) s0) =
let o = get () in
put x;
addx y;
let r = get () in
put o;
r | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.unit | Prims.Tot | [
"total"
] | [] | [
"Prims.int",
"FStar.IO.print_string",
"FStar.Printf.sprintf",
"Prims.unit",
"FStar.Pervasives.Native.tuple2",
"FStar.Ghost.reveal",
"FStar.Ghost.hide",
"Prims.l_True",
"DM4F_layered5.add_via_state"
] | [] | false | false | false | true | false | let main =
| let r, n = reify (reify (add_via_state 1 2) 3) (Ghost.hide (fun _ -> True)) () in
FStar.IO.print_string (FStar.Printf.sprintf "%d:%d\n" r n) | false |
|
FStar.Bytes.fsti | FStar.Bytes.fits_in_k_bytes | val fits_in_k_bytes : n: Prims.nat -> k: Prims.nat -> Type0 | let fits_in_k_bytes (n:nat) (k:nat) = FStar.UInt.size n (op_Multiply 8 k) | {
"file_name": "ulib/FStar.Bytes.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 73,
"end_line": 165,
"start_col": 0,
"start_line": 165
} | (*
Copyright 2008-2017 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.
*)
(*
A standard library for manipulation of value bytes.
This model is realized by Bytes.bytes in OCaml and by
struct {uintX_t size; char *bytes} (or similar) in C.
This file is essentially a specialized version of FStar.Seq,
with lemmas and refinements taylored for typical operations on
bytes, and with support for machine integers and C-extractible versions
(which Seq does not provide.)
@summary Value bytes standard library
*)
module FStar.Bytes
module S = FStar.Seq
module U = FStar.UInt
module U8 = FStar.UInt8
module U16 = FStar.UInt16
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Str = FStar.String
module Chr = FStar.Char
unfold let u8 = U8.t
unfold let u16 = U16.t
unfold let u32 = U32.t
(** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *)
unfold type byte = u8
(** Realized in C by a pair of a length field and uint8_t* in C
Realized in OCaml by a string *)
val bytes : t:Type0{hasEq t}
val len : bytes -> u32
unfold let length b = FStar.UInt32.v (len b)
(** representation for specs that need lemmas not defined here. *)
val reveal:
bytes
-> GTot (S.seq byte)
val length_reveal:
x:bytes
-> Lemma (ensures (S.length (reveal x) = length x))
[SMTPatOr [[SMTPat (S.length (reveal x))];
[SMTPat (len x)]]]
val hide:
s:S.seq byte{S.length s < pow2 32}
-> GTot bytes
val hide_reveal:
x:bytes
-> Lemma (ensures (hide (reveal x) = x))
[SMTPat (reveal x)]
val reveal_hide:
x:S.seq byte{S.length x < pow2 32}
-> Lemma (ensures (reveal (hide x) == x))
[SMTPat (hide x)]
type lbytes (l:nat) = b:bytes{length b = l}
type kbytes (k:nat) = b:bytes{length b < pow2 k}
let lbytes32 (l:UInt32.t) = b:bytes{len b = l}
val empty_bytes : lbytes 0
val empty_unique:
b:bytes
-> Lemma (length b = 0 ==> b = empty_bytes)
[SMTPat (len b)]
(** If you statically know the length, it is OK to read at arbitrary indexes *)
val get:
b:bytes
-> pos:u32{U32.v pos < length b}
-> Pure byte
(requires True)
(ensures (fun y -> y == S.index (reveal b) (U32.v pos)))
unfold let op_String_Access = get
unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i)
let equal b1 b2 =
length b1 = length b2 /\
(forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i])
val extensionality:
b1:bytes
-> b2:bytes
-> Lemma (requires (equal b1 b2))
(ensures (b1 = b2))
(** creating byte values **)
val create:
len:u32
-> v:byte
-> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == v}
unfold
let create_ (n:nat{FStar.UInt.size n U32.n}) v = create (U32.uint_to_t n) v
val init:
len:u32
-> f:(i:u32{U32.(i <^ len)} -> byte)
-> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == f i}
// this is a hack JROESCH
val abyte (b:byte) : lbytes 1
(* admit () create 1ul b *)
val twobytes (b:byte*byte) : lbytes 2
// init 2ul (fun i -> if i = 0ul then fst b else snd b)
(** appending bytes **)
val append:
b1:bytes
-> b2:bytes
-> Pure bytes
(requires (UInt.size (length b1 + length b2) U32.n))
(ensures (fun b -> reveal b == S.append (reveal b1) (reveal b2)))
unfold let op_At_Bar = append
val slice:
b:bytes
-> s:u32
-> e:u32{U32.(s <=^ e) /\ U32.v e <= length b}
-> r:bytes{reveal r == Seq.slice (reveal b) (U32.v s) (U32.v e)}
let slice_ b (s:nat) (e:nat{s <= e /\ e <= length b}) = slice b (U32.uint_to_t s) (U32.uint_to_t e)
val sub:
b:bytes
-> s:u32
-> l:u32{U32.v s + U32.v l <= length b}
-> r:bytes{reveal r == Seq.slice (reveal b) (U32.v s) (U32.v s + U32.v l)}
val split:
b:bytes
-> k:u32{U32.v k <= length b}
-> p:(bytes*bytes){
let x, y = p in
(reveal x, reveal y) == Seq.split (reveal b) (U32.v k)}
unfold let split_ b (k:nat{FStar.UInt.size k U32.n /\ k < length b}) = split b (U32.uint_to_t k) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.String.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.Char.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Bytes.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Char",
"short_module": "Chr"
},
{
"abbrev": true,
"full_module": "FStar.String",
"short_module": "Str"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.nat -> k: Prims.nat -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"FStar.UInt.size",
"Prims.op_Multiply"
] | [] | false | false | false | true | true | let fits_in_k_bytes (n k: nat) =
| FStar.UInt.size n (op_Multiply 8 k) | false |
|
Pulse.Checker.Base.fst | Pulse.Checker.Base.readback_comp_res_as_comp | val readback_comp_res_as_comp (c: T.comp) : option comp | val readback_comp_res_as_comp (c: T.comp) : option comp | let readback_comp_res_as_comp (c:T.comp) : option comp =
match c with
| T.C_Total t -> (
match readback_comp t with
| None -> None
| Some c -> Some c
)
| _ -> None | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 13,
"end_line": 681,
"start_col": 0,
"start_line": 674
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r
let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res)
let comp_st_with_post (c:comp_st) (post:term)
: c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } =
match c with
| C_ST st -> C_ST { st with post }
| C_STGhost st -> C_STGhost { st with post }
| C_STAtomic i obs st -> C_STAtomic i obs {st with post}
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)
: option (st_equiv g c0 c2)
=
match d01 with
| ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 -> (
let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in
if x = y && eq_tm (comp_res c0) (comp_res c1)
then Some (
ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing
(RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)
(VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)
(VE_Trans _ _ _ _ eq_post_01 eq_post_12)
)
else None
)
| ST_TotEquiv g t1 t2 u typing eq ->
let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in
let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in
Some (ST_TotEquiv g t1 t3 u typing eq'')
let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c')
: st_typing g st c'
= match d with
| T_Equiv _ _ _ _ d0 eq' -> (
match st_equiv_trans eq' eq with
| None -> T_Equiv _ _ _ _ d eq
| Some eq'' -> T_Equiv _ _ _ _ d0 eq''
)
| _ -> T_Equiv _ _ _ _ d eq
let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { freevars post `Set.subset` freevars (comp_post c)})
(veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } ->
vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post)
= if eq_tm post (comp_post c) then d
else
let c' = comp_st_with_post c post in
let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let veq = veq x in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq
in
t_equiv d st_equiv
let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { comp_post c == tm_star post tm_emp})
: st_typing g t (comp_st_with_post c post)
= st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x))
let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t)
: Lemma
(requires
comp_post_matches_hint c post_hint /\
effect_annot_of_comp c == effect_annot_of_comp c' /\
comp_res c' == comp_res c /\
comp_u c' == comp_u c /\
comp_post c' == tm_star (comp_post c) tm_emp)
(ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\
comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c')
= ()
let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g p ctxt)
: tot_typing g p tm_vprop
= let _, bk = vprop_equiv_typing d in
bk ctxt_typing
let comp_with_pre (c:comp_st) (pre:term) =
match c with
| C_ST st -> C_ST { st with pre }
| C_STGhost st -> C_STGhost { st with pre }
| C_STAtomic i obs st -> C_STAtomic i obs {st with pre}
let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(pre:term)
(veq: vprop_equiv g (comp_pre c) pre)
: st_typing g t (comp_with_pre c pre)
= if eq_tm pre (comp_pre c) then d
else
let c' = comp_with_pre c pre in
let (| u_of, pre_typing, x, post_typing |) =
Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _)
in
t_equiv d st_equiv
#push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0"
let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term)
(k:continuation_elaborator g1 ctxt g2 ctxt1)
(d:vprop_equiv g2 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt g2 ctxt2 =
fun post_hint res ->
let (| st, c, st_d |) = res in
let st_d : st_typing g2 st c = st_d in
assert (comp_pre c == ctxt2);
let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in
k post_hint (| st, _, st_d' |)
#pop-options
let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g ctxt p)
: tot_typing g p tm_vprop
= let fwd, _ = vprop_equiv_typing d in
fwd ctxt_typing
#push-options "--z3rlimit_factor 4 --ifuel 1 --fuel 0"
let k_elab_equiv_prefix
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt)
(d:vprop_equiv g1 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt2 g2 ctxt =
fun post_hint res ->
let framing_token : frame_for_req_in_ctxt g1 ctxt2 ctxt1 =
let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in
(| tm_emp, emp_typing, d |)
in
let res = k post_hint res in
let (| st, c, st_d |) = res in
assert (comp_pre c == ctxt1);
(| _, _, st_equiv_pre st_d _ d |)
#pop-options
let k_elab_equiv
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt2)
(d1:vprop_equiv g1 ctxt1 ctxt1')
(d2:vprop_equiv g2 ctxt2 ctxt2')
: continuation_elaborator g1 ctxt1' g2 ctxt2' =
let k : continuation_elaborator g1 ctxt1 g2 ctxt2' =
k_elab_equiv_continuation k d2 in
let k : continuation_elaborator g1 ctxt1' g2 ctxt2' =
k_elab_equiv_prefix k d1 in
k
#push-options "--query_stats --fuel 2 --ifuel 2 --split_queries no --z3rlimit_factor 20"
open Pulse.PP
let continuation_elaborator_with_bind (#g:env) (ctxt:term)
(#c1:comp{stateful_comp c1})
(#e1:st_term)
(e1_typing:st_typing g e1 c1)
(ctxt_pre1_typing:tot_typing g (tm_star ctxt (comp_pre c1)) tm_vprop)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g
(tm_star ctxt (comp_pre c1))
(push_binding g (snd x) (fst x) (comp_res c1))
(tm_star (open_term (comp_post c1) (snd x)) ctxt)) =
let pre1 = comp_pre c1 in
let res1 = comp_res c1 in
let post1 = comp_post c1 in
let ctxt_typing = star_typing_inversion_l ctxt_pre1_typing in
// let p_prop = Metatheory.pure_typing_inversion pure_typing in
let v_eq = VE_Comm g ctxt pre1 in
let framing_token : frame_for_req_in_ctxt g (tm_star ctxt pre1) pre1 =
(| ctxt, ctxt_typing, VE_Comm g pre1 ctxt |)
in
let (| c1, e1_typing |) =
apply_frame ctxt_pre1_typing e1_typing framing_token in
let (| u_of_1, pre_typing, _, _ |) =
Metatheory.(st_comp_typing_inversion (fst <| comp_typing_inversion (st_typing_correctness e1_typing))) in
let b = res1 in
let ppname, x = x in
let g' = push_binding g x ppname b in
let post1_opened = open_term_nv post1 (v_as_nv x) in
let k : continuation_elaborator g (tm_star ctxt pre1) g' (tm_star post1_opened ctxt) =
fun post_hint res ->
let (| e2, c2, e2_typing |) = res in
assert (comp_post_matches_hint c2 post_hint);
let e2_typing : st_typing g' e2 c2 = e2_typing in
let e2_closed = close_st_term e2 x in
assume (open_st_term e2_closed x == e2);
assert (comp_pre c1 == (tm_star ctxt pre1));
assert (comp_post c1 == tm_star post1 ctxt);
assert (comp_pre c2 == tm_star post1_opened ctxt);
assert (open_term (comp_post c1) x == tm_star post1_opened (open_term ctxt x));
// ctxt is well-typed, hence ln
assume (open_term ctxt x == ctxt);
assert (open_term (comp_post c1) x == comp_pre c2);
// we closed e2 with x
assume (~ (x `Set.mem` freevars_st e2_closed));
if x `Set.mem` freevars (comp_post c2)
then fail g' None "Impossible: freevar clash when constructing continuation elaborator for bind, please file a bug-report"
else (
let t_typing, post_typing =
Pulse.Typing.Combinators.bind_res_and_post_typing g c2 x post_hint in
let g = push_context g "mk_bind" e1.range in
// info_doc g None
// [prefix 4 1 (doc_of_string "mk_bind e1 = ") (doc_of_string (Pulse.Syntax.Printer.st_term_to_string e1));
// prefix 4 1 (doc_of_string "mk_bind c1 = ") (pp #comp c1);
// prefix 4 1 (doc_of_string "mk_bind e2 = ") (doc_of_string (Pulse.Syntax.Printer.st_term_to_string e2));
// prefix 4 1 (doc_of_string "mk_bind c2 = ") (pp #comp c2)]
// ;
let (| e, c, e_typing |) =
Pulse.Typing.Combinators.mk_bind
g (tm_star ctxt pre1)
e1 e2_closed c1 c2 (ppname, x) e1_typing
u_of_1
e2_typing
t_typing
post_typing
(Some? post_hint)
in
(| e, c, e_typing |)
)
in
k
#pop-options
module LN = Pulse.Typing.LN
#push-options "--z3rlimit_factor 4 --fuel 1 --ifuel 1"
let st_comp_typing_with_post_hint
(#g:env) (#ctxt:_)
(ctxt_typing:tot_typing g ctxt tm_vprop)
(post_hint:post_hint_opt g { Some? post_hint })
(c:comp_st { comp_pre c == ctxt /\ comp_post_matches_hint c post_hint })
: st_comp_typing g (st_comp_of_comp c)
= let st = st_comp_of_comp c in
let Some ph = post_hint in
let post_typing_src
: tot_typing (push_binding ph.g ph.x ppname_default ph.ret_ty)
(open_term ph.post ph.x) tm_vprop
= ph.post_typing_src
in
let x = fresh g in
assume (fresh_wrt x g (freevars ph.post));
assume (None? (lookup g ph.x));
let post_typing_src
: tot_typing (push_binding ph.g x ppname_default ph.ret_ty)
(open_term ph.post x) tm_vprop
= if x = ph.x
then post_typing_src
else
let open Pulse.Typing.Metatheory.Base in
let tt :
tot_typing
(push_binding ph.g x ppname_default ph.ret_ty)
(subst_term (open_term ph.post ph.x) (renaming ph.x x))
(subst_term tm_vprop (renaming ph.x x)) =
tot_typing_renaming1 ph.g ph.x ph.ret_ty (open_term ph.post ph.x) tm_vprop post_typing_src x
in
assert (subst_term tm_vprop (renaming ph.x x) == tm_vprop);
assume (subst_term (open_term ph.post ph.x) (renaming ph.x x) ==
open_term ph.post x);
tt
in
let post_typing_src
: tot_typing (push_binding g x ppname_default ph.ret_ty)
(open_term ph.post x) tm_vprop
= //weakening: TODO
RU.magic ()
in
let ty_typing : universe_of ph.g st.res st.u = ph.ty_typing in
let ty_typing : universe_of g st.res st.u =
Pulse.Typing.Metatheory.tot_typing_weakening_standard ph.g ty_typing g
in
assert (st.res == ph.ret_ty);
assert (st.post == ph.post);
STC g st x ty_typing ctxt_typing post_typing_src
let continuation_elaborator_with_bind_fn (#g:env) (#ctxt:term)
(ctxt_typing:tot_typing g ctxt tm_vprop)
(#e1:st_term)
(#c1:comp { C_Tot? c1 })
(b:binder{b.binder_ty == comp_res c1})
(e1_typing:st_typing g e1 c1)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g ctxt
(push_binding g (snd x) ppname_default (comp_res c1)) ctxt)
= let t1 = comp_res c1 in
assert ((push_binding g (snd x) (fst x) t1) `env_extends` g);
fun post_hint (| e2, c2, d2 |) ->
if None? post_hint then T.fail "bind_fn: expects the post_hint to be set";
let ppname, x = x in
let e2_closed = close_st_term e2 x in
assume (open_st_term (close_st_term e2 x) x == e2);
let e = wr c2 (Tm_Bind {binder=b; head=e1; body=e2_closed}) in
let (| u, c1_typing |) = Pulse.Typing.Metatheory.Base.st_typing_correctness_ctot e1_typing in
let c2_typing : comp_typing g c2 (universe_of_comp c2) =
match c2 with
| C_ST st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
let i_typing = CP.core_check_term g i T.E_Total tm_inames in
CT_STAtomic _ _ obs _ i_typing stc
| C_STGhost st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
CT_STGhost _ _ stc
in
let d : st_typing g e c2 =
T_BindFn g e1 e2_closed c1 c2 b x e1_typing u c1_typing d2 c2_typing
in
(| e, c2, d |)
let rec check_equiv_emp (g:env) (vp:term)
: option (vprop_equiv g vp tm_emp)
= match vp.t with
| Tm_Emp -> Some (VE_Refl _ _)
| Tm_Star vp1 vp2 ->
(match check_equiv_emp g vp1, check_equiv_emp g vp2 with
| Some d1, Some d2 ->
let d3 : vprop_equiv g (tm_star vp1 vp2) (tm_star tm_emp tm_emp)
= VE_Ctxt _ _ _ _ _ d1 d2 in
let d4 : vprop_equiv g (tm_star tm_emp tm_emp) tm_emp =
VE_Unit _ _ in
Some (VE_Trans _ _ _ _ d3 d4)
| _, _ -> None)
| _ -> None
let emp_inames_included (g:env) (i:term) (_:tot_typing g i tm_inames)
: prop_validity g (tm_inames_subset tm_emp_inames i)
= RU.magic()
let return_in_ctxt (g:env) (y:var) (y_ppname:ppname) (u:universe) (ty:term) (ctxt:vprop)
(ty_typing:universe_of g ty u)
(post_hint0:post_hint_opt g { Some? post_hint0 /\ checker_res_matches_post_hint g post_hint0 y ty ctxt})
: Pure (st_typing_in_ctxt g ctxt post_hint0)
(requires lookup g y == Some ty)
(ensures fun _ -> True)
= let Some post_hint = post_hint0 in
let x = fresh g in
assume (~ (x `Set.mem` freevars post_hint.post));
let ctag =
match post_hint.effect_annot with
| EffectAnnotAtomic _ -> STT_Atomic
| EffectAnnotGhost -> STT_Ghost
| _ -> STT
in
let y_tm = tm_var {nm_index=y;nm_ppname=y_ppname} in
let d = T_Return g ctag false u ty y_tm post_hint.post x ty_typing
(RU.magic ()) // that null_var y is well typed at ty in g, we know since lookup g y == Some ty
(RU.magic ()) // typing of (open post x) in (g, x) ... post_hint is well-typed, so should get
in
let t = wtag (Some ctag) (Tm_Return {expected_type=tm_unknown;insert_eq=false;term=y_tm}) in
let c = comp_return ctag false u ty y_tm post_hint.post x in
let d : st_typing g t c = d in
assume (comp_u c == post_hint.u); // this u should follow from equality of t
match c, post_hint.effect_annot with
| C_STAtomic _ obs _, EffectAnnotAtomic { opens } ->
assert (comp_inames c == tm_emp_inames);
let pht = post_hint_typing g post_hint x in
let validity = emp_inames_included g opens pht.effect_annot_typing in
let d = T_Sub _ _ _ _ d (STS_AtomicInvs _ (st_comp_of_comp c) tm_emp_inames opens obs obs validity) in
(| _, _, d |)
| _ ->
(| _, _, d |)
let match_comp_res_with_post_hint (#g:env) (#t:st_term) (#c:comp_st)
(d:st_typing g t c)
(post_hint:post_hint_opt g)
: T.Tac (t':st_term &
c':comp_st &
st_typing g t' c') =
match post_hint with
| None -> (| t, c, d |)
| Some { ret_ty } ->
let cres = comp_res c in
if eq_tm cres ret_ty
then (| t, c, d |)
else match Pulse.Checker.Pure.check_equiv g cres ret_ty with
| None ->
fail g (Some t.range)
(Printf.sprintf "Could not prove equiv for computed type %s and expected type %s"
(P.term_to_string cres)
(P.term_to_string ret_ty))
| Some tok ->
let d_equiv
: RT.equiv _ (elab_term cres) (elab_term ret_ty) =
RT.Rel_eq_token _ _ _ (FStar.Squash.return_squash tok) in
let c' = with_st_comp c {(st_comp_of_comp c) with res = ret_ty } in
let (| cres_typing, cpre_typing, x, cpost_typing |) =
st_comp_typing_inversion (fst <| comp_typing_inversion (st_typing_correctness d)) in
let d_stequiv : st_equiv g c c' =
ST_VPropEquiv _ c c' _ cpre_typing cres_typing cpost_typing d_equiv (VE_Refl _ _) (VE_Refl _ _)
in
(| t, c', T_Equiv _ _ _ _ d d_stequiv |)
let apply_checker_result_k (#g:env) (#ctxt:vprop) (#post_hint:post_hint_for_env g)
(r:checker_result_t g ctxt (Some post_hint))
(res_ppname:ppname)
: T.Tac (st_typing_in_ctxt g ctxt (Some post_hint)) =
// TODO: FIXME add to checker result type?
let (| y, g1, (| u_ty, ty_y, d_ty_y |), (| pre', _ |), k |) = r in
let (| u_ty_y, d_ty_y |) = Pulse.Checker.Pure.check_universe g1 ty_y in
let d : st_typing_in_ctxt g1 pre' (Some post_hint) =
return_in_ctxt g1 y res_ppname u_ty_y ty_y pre' d_ty_y (Some post_hint) in
k (Some post_hint) d
#push-options "--z3rlimit_factor 4 --fuel 0 --ifuel 1 --query_stats"
let checker_result_for_st_typing (#g:env) (#ctxt:vprop) (#post_hint:post_hint_opt g)
(d:st_typing_in_ctxt g ctxt post_hint)
(ppname:ppname)
: T.Tac (checker_result_t g ctxt post_hint) =
let (| t, c, d |) = d in
let x = fresh g in
let g' = push_binding g x ppname (comp_res c) in
let ctxt' = open_term_nv (comp_post c) (ppname, x) in
let k
: continuation_elaborator
g (tm_star tm_emp (comp_pre c))
g' (tm_star ctxt' tm_emp) =
continuation_elaborator_with_bind tm_emp d (RU.magic ()) (ppname, x) in
let k
: continuation_elaborator g (comp_pre c) g' ctxt' =
k_elab_equiv k (RU.magic ()) (RU.magic ()) in
let _ : squash (checker_res_matches_post_hint g post_hint x (comp_res c) ctxt') =
match post_hint with
| None -> ()
| Some post_hint -> () in
assert (g' `env_extends` g);
let comp_res_typing, _, f =
Metatheory.(st_comp_typing_inversion_cofinite (fst <| comp_typing_inversion (st_typing_correctness d))) in
// RU.magic is the typing of comp_res in g'
// weaken comp_res_typing
assume (~ (x `Set.mem` freevars (comp_post c)));
let tt : universe_of _ _ _ = RU.magic () in
(| x, g', (| comp_u c, comp_res c, tt |), (| ctxt', f x |), k |)
#pop-options
module R = FStar.Reflection.V2 | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.LN",
"short_module": "LN"
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: FStar.Tactics.NamedView.comp -> FStar.Pervasives.Native.option Pulse.Syntax.Base.comp | Prims.Tot | [
"total"
] | [] | [
"FStar.Tactics.NamedView.comp",
"FStar.Stubs.Reflection.Types.typ",
"Pulse.Readback.readback_comp",
"FStar.Pervasives.Native.None",
"Pulse.Syntax.Base.comp",
"Prims.eq2",
"FStar.Stubs.Reflection.Types.term",
"Pulse.Elaborate.Pure.elab_comp",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.option",
"FStar.Stubs.Reflection.V2.Data.comp_view"
] | [] | false | false | false | true | false | let readback_comp_res_as_comp (c: T.comp) : option comp =
| match c with
| T.C_Total t ->
(match readback_comp t with
| None -> None
| Some c -> Some c)
| _ -> None | false |
FStar.Bytes.fsti | FStar.Bytes.xor_ | val xor_ : b1: FStar.Bytes.minbytes n -> b2: FStar.Bytes.minbytes n
-> b: FStar.Bytes.bytes{FStar.Bytes.len b = FStar.UInt32.uint_to_t n} | let xor_ (#n:nat{FStar.UInt.size n U32.n}) (b1:minbytes n) (b2:minbytes n) = xor (U32.uint_to_t n) b1 b2 | {
"file_name": "ulib/FStar.Bytes.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 111,
"end_line": 247,
"start_col": 7,
"start_line": 247
} | (*
Copyright 2008-2017 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.
*)
(*
A standard library for manipulation of value bytes.
This model is realized by Bytes.bytes in OCaml and by
struct {uintX_t size; char *bytes} (or similar) in C.
This file is essentially a specialized version of FStar.Seq,
with lemmas and refinements taylored for typical operations on
bytes, and with support for machine integers and C-extractible versions
(which Seq does not provide.)
@summary Value bytes standard library
*)
module FStar.Bytes
module S = FStar.Seq
module U = FStar.UInt
module U8 = FStar.UInt8
module U16 = FStar.UInt16
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Str = FStar.String
module Chr = FStar.Char
unfold let u8 = U8.t
unfold let u16 = U16.t
unfold let u32 = U32.t
(** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *)
unfold type byte = u8
(** Realized in C by a pair of a length field and uint8_t* in C
Realized in OCaml by a string *)
val bytes : t:Type0{hasEq t}
val len : bytes -> u32
unfold let length b = FStar.UInt32.v (len b)
(** representation for specs that need lemmas not defined here. *)
val reveal:
bytes
-> GTot (S.seq byte)
val length_reveal:
x:bytes
-> Lemma (ensures (S.length (reveal x) = length x))
[SMTPatOr [[SMTPat (S.length (reveal x))];
[SMTPat (len x)]]]
val hide:
s:S.seq byte{S.length s < pow2 32}
-> GTot bytes
val hide_reveal:
x:bytes
-> Lemma (ensures (hide (reveal x) = x))
[SMTPat (reveal x)]
val reveal_hide:
x:S.seq byte{S.length x < pow2 32}
-> Lemma (ensures (reveal (hide x) == x))
[SMTPat (hide x)]
type lbytes (l:nat) = b:bytes{length b = l}
type kbytes (k:nat) = b:bytes{length b < pow2 k}
let lbytes32 (l:UInt32.t) = b:bytes{len b = l}
val empty_bytes : lbytes 0
val empty_unique:
b:bytes
-> Lemma (length b = 0 ==> b = empty_bytes)
[SMTPat (len b)]
(** If you statically know the length, it is OK to read at arbitrary indexes *)
val get:
b:bytes
-> pos:u32{U32.v pos < length b}
-> Pure byte
(requires True)
(ensures (fun y -> y == S.index (reveal b) (U32.v pos)))
unfold let op_String_Access = get
unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i)
let equal b1 b2 =
length b1 = length b2 /\
(forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i])
val extensionality:
b1:bytes
-> b2:bytes
-> Lemma (requires (equal b1 b2))
(ensures (b1 = b2))
(** creating byte values **)
val create:
len:u32
-> v:byte
-> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == v}
unfold
let create_ (n:nat{FStar.UInt.size n U32.n}) v = create (U32.uint_to_t n) v
val init:
len:u32
-> f:(i:u32{U32.(i <^ len)} -> byte)
-> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == f i}
// this is a hack JROESCH
val abyte (b:byte) : lbytes 1
(* admit () create 1ul b *)
val twobytes (b:byte*byte) : lbytes 2
// init 2ul (fun i -> if i = 0ul then fst b else snd b)
(** appending bytes **)
val append:
b1:bytes
-> b2:bytes
-> Pure bytes
(requires (UInt.size (length b1 + length b2) U32.n))
(ensures (fun b -> reveal b == S.append (reveal b1) (reveal b2)))
unfold let op_At_Bar = append
val slice:
b:bytes
-> s:u32
-> e:u32{U32.(s <=^ e) /\ U32.v e <= length b}
-> r:bytes{reveal r == Seq.slice (reveal b) (U32.v s) (U32.v e)}
let slice_ b (s:nat) (e:nat{s <= e /\ e <= length b}) = slice b (U32.uint_to_t s) (U32.uint_to_t e)
val sub:
b:bytes
-> s:u32
-> l:u32{U32.v s + U32.v l <= length b}
-> r:bytes{reveal r == Seq.slice (reveal b) (U32.v s) (U32.v s + U32.v l)}
val split:
b:bytes
-> k:u32{U32.v k <= length b}
-> p:(bytes*bytes){
let x, y = p in
(reveal x, reveal y) == Seq.split (reveal b) (U32.v k)}
unfold let split_ b (k:nat{FStar.UInt.size k U32.n /\ k < length b}) = split b (U32.uint_to_t k)
(** Interpret a sequence of bytes as a mathematical integer encoded in big endian **)
let fits_in_k_bytes (n:nat) (k:nat) = FStar.UInt.size n (op_Multiply 8 k)
type uint_k (k:nat) = n:nat{fits_in_k_bytes n k}
(** repr_bytes n: The number of bytes needed to represent a nat **)
val repr_bytes:
n:nat
-> k:pos{fits_in_k_bytes n k}
val lemma_repr_bytes_values:
n:nat
-> Lemma (ensures ( let k = repr_bytes n in
if n < 256 then k==1
else if n < 65536 then k==2
else if n < 16777216 then k==3
else if n < 4294967296 then k==4
else if n < 1099511627776 then k==5
else if n < 281474976710656 then k==6
else if n < 72057594037927936 then k==7
else if n < 18446744073709551616 then k==8
else True ))
[SMTPat (repr_bytes n)]
val repr_bytes_size:
k:nat
-> n:uint_k k
-> Lemma (ensures (repr_bytes n <= k))
[SMTPat (fits_in_k_bytes n k)]
val int_of_bytes:
b:bytes
-> Tot (uint_k (length b))
val bytes_of_int:
k:nat
-> n:nat{repr_bytes n <= k /\ k < pow2 32}
-> lbytes k
val int_of_bytes_of_int:
#k:nat{k <= 32}
-> n:uint_k k
-> Lemma (ensures (int_of_bytes (bytes_of_int k n) == n))
[SMTPat (bytes_of_int k n)]
val bytes_of_int_of_bytes:
b:bytes{length b <= 32}
-> Lemma (ensures (bytes_of_int (length b) (int_of_bytes b) == b))
[SMTPat (int_of_bytes b)]
//18-02-25 use [uint32] instead of [int32] etc?
val int32_of_bytes:
b:bytes{length b <= 4}
-> n:u32{U32.v n == int_of_bytes b}
val int16_of_bytes:
b:bytes{length b <= 2}
-> n:u16{U16.v n == int_of_bytes b}
val int8_of_bytes:
b:bytes{length b = 1}
-> n:u8{U8.v n = int_of_bytes b}
val bytes_of_int32:
n:U32.t
-> b:lbytes 4{b == bytes_of_int 4 (U32.v n)}
val bytes_of_int16:
n:U16.t
-> b:lbytes 2{b == bytes_of_int 2 (U16.v n)}
val bytes_of_int8:
n:U8.t
-> b:lbytes 1{b == bytes_of_int 1 (U8.v n)}
////////////////////////////////////////////////////////////////////////////////
type minbytes (n:nat) = b:bytes{length b >= n}
val xor:
n:u32
-> b1:minbytes (U32.v n)
-> b2:minbytes (U32.v n)
-> b:bytes{len b = n} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.String.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.Char.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Bytes.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Char",
"short_module": "Chr"
},
{
"abbrev": true,
"full_module": "FStar.String",
"short_module": "Str"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b1: FStar.Bytes.minbytes n -> b2: FStar.Bytes.minbytes n
-> b: FStar.Bytes.bytes{FStar.Bytes.len b = FStar.UInt32.uint_to_t n} | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"FStar.UInt.size",
"FStar.UInt32.n",
"FStar.Bytes.minbytes",
"FStar.Bytes.xor",
"FStar.UInt32.uint_to_t",
"FStar.Bytes.bytes",
"Prims.b2t",
"Prims.op_Equality",
"FStar.Bytes.u32",
"FStar.Bytes.len"
] | [] | false | false | false | false | false | let xor_ (#n: nat{FStar.UInt.size n U32.n}) (b1 b2: minbytes n) =
| xor (U32.uint_to_t n) b1 b2 | false |
|
FStar.Bytes.fsti | FStar.Bytes.split_ | val split_ : b: FStar.Bytes.bytes -> k: Prims.nat{FStar.UInt.size k FStar.UInt32.n /\ k < FStar.Bytes.length b}
-> p:
(FStar.Bytes.bytes * FStar.Bytes.bytes)
{ let _ = p in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ x y = _ in
(FStar.Bytes.reveal x,
FStar.Bytes.reveal y) ==
FStar.Seq.Properties.split (FStar.Bytes.reveal b)
(FStar.UInt32.v (FStar.UInt32.uint_to_t k)))
<:
Type0 } | let split_ b (k:nat{FStar.UInt.size k U32.n /\ k < length b}) = split b (U32.uint_to_t k) | {
"file_name": "ulib/FStar.Bytes.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 96,
"end_line": 162,
"start_col": 7,
"start_line": 162
} | (*
Copyright 2008-2017 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.
*)
(*
A standard library for manipulation of value bytes.
This model is realized by Bytes.bytes in OCaml and by
struct {uintX_t size; char *bytes} (or similar) in C.
This file is essentially a specialized version of FStar.Seq,
with lemmas and refinements taylored for typical operations on
bytes, and with support for machine integers and C-extractible versions
(which Seq does not provide.)
@summary Value bytes standard library
*)
module FStar.Bytes
module S = FStar.Seq
module U = FStar.UInt
module U8 = FStar.UInt8
module U16 = FStar.UInt16
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Str = FStar.String
module Chr = FStar.Char
unfold let u8 = U8.t
unfold let u16 = U16.t
unfold let u32 = U32.t
(** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *)
unfold type byte = u8
(** Realized in C by a pair of a length field and uint8_t* in C
Realized in OCaml by a string *)
val bytes : t:Type0{hasEq t}
val len : bytes -> u32
unfold let length b = FStar.UInt32.v (len b)
(** representation for specs that need lemmas not defined here. *)
val reveal:
bytes
-> GTot (S.seq byte)
val length_reveal:
x:bytes
-> Lemma (ensures (S.length (reveal x) = length x))
[SMTPatOr [[SMTPat (S.length (reveal x))];
[SMTPat (len x)]]]
val hide:
s:S.seq byte{S.length s < pow2 32}
-> GTot bytes
val hide_reveal:
x:bytes
-> Lemma (ensures (hide (reveal x) = x))
[SMTPat (reveal x)]
val reveal_hide:
x:S.seq byte{S.length x < pow2 32}
-> Lemma (ensures (reveal (hide x) == x))
[SMTPat (hide x)]
type lbytes (l:nat) = b:bytes{length b = l}
type kbytes (k:nat) = b:bytes{length b < pow2 k}
let lbytes32 (l:UInt32.t) = b:bytes{len b = l}
val empty_bytes : lbytes 0
val empty_unique:
b:bytes
-> Lemma (length b = 0 ==> b = empty_bytes)
[SMTPat (len b)]
(** If you statically know the length, it is OK to read at arbitrary indexes *)
val get:
b:bytes
-> pos:u32{U32.v pos < length b}
-> Pure byte
(requires True)
(ensures (fun y -> y == S.index (reveal b) (U32.v pos)))
unfold let op_String_Access = get
unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i)
let equal b1 b2 =
length b1 = length b2 /\
(forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i])
val extensionality:
b1:bytes
-> b2:bytes
-> Lemma (requires (equal b1 b2))
(ensures (b1 = b2))
(** creating byte values **)
val create:
len:u32
-> v:byte
-> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == v}
unfold
let create_ (n:nat{FStar.UInt.size n U32.n}) v = create (U32.uint_to_t n) v
val init:
len:u32
-> f:(i:u32{U32.(i <^ len)} -> byte)
-> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == f i}
// this is a hack JROESCH
val abyte (b:byte) : lbytes 1
(* admit () create 1ul b *)
val twobytes (b:byte*byte) : lbytes 2
// init 2ul (fun i -> if i = 0ul then fst b else snd b)
(** appending bytes **)
val append:
b1:bytes
-> b2:bytes
-> Pure bytes
(requires (UInt.size (length b1 + length b2) U32.n))
(ensures (fun b -> reveal b == S.append (reveal b1) (reveal b2)))
unfold let op_At_Bar = append
val slice:
b:bytes
-> s:u32
-> e:u32{U32.(s <=^ e) /\ U32.v e <= length b}
-> r:bytes{reveal r == Seq.slice (reveal b) (U32.v s) (U32.v e)}
let slice_ b (s:nat) (e:nat{s <= e /\ e <= length b}) = slice b (U32.uint_to_t s) (U32.uint_to_t e)
val sub:
b:bytes
-> s:u32
-> l:u32{U32.v s + U32.v l <= length b}
-> r:bytes{reveal r == Seq.slice (reveal b) (U32.v s) (U32.v s + U32.v l)}
val split:
b:bytes
-> k:u32{U32.v k <= length b}
-> p:(bytes*bytes){
let x, y = p in
(reveal x, reveal y) == Seq.split (reveal b) (U32.v k)} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt16.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.String.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.Char.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Bytes.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.Char",
"short_module": "Chr"
},
{
"abbrev": true,
"full_module": "FStar.String",
"short_module": "Str"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.UInt16",
"short_module": "U16"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "U"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: FStar.Bytes.bytes -> k: Prims.nat{FStar.UInt.size k FStar.UInt32.n /\ k < FStar.Bytes.length b}
-> p:
(FStar.Bytes.bytes * FStar.Bytes.bytes)
{ let _ = p in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ x y = _ in
(FStar.Bytes.reveal x,
FStar.Bytes.reveal y) ==
FStar.Seq.Properties.split (FStar.Bytes.reveal b)
(FStar.UInt32.v (FStar.UInt32.uint_to_t k)))
<:
Type0 } | Prims.Tot | [
"total"
] | [] | [
"FStar.Bytes.bytes",
"Prims.nat",
"Prims.l_and",
"FStar.UInt.size",
"FStar.UInt32.n",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Bytes.length",
"FStar.Bytes.split",
"FStar.UInt32.uint_to_t",
"FStar.Pervasives.Native.tuple2",
"Prims.eq2",
"FStar.Seq.Base.seq",
"FStar.Bytes.byte",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Bytes.reveal",
"FStar.Seq.Properties.split",
"FStar.UInt32.v"
] | [] | false | false | false | false | false | let split_ b (k: nat{FStar.UInt.size k U32.n /\ k < length b}) =
| split b (U32.uint_to_t k) | false |
|
DM4F_layered5.fst | DM4F_layered5.put | val put (#st: _) (s: st) : ST unit st (fun _ p -> p () s) | val put (#st: _) (s: st) : ST unit st (fun _ p -> p () s) | let put #st (s:st) : ST unit st (fun _ p -> p () s) =
ST?.reflect (fun _ -> ((), s)) | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 32,
"end_line": 125,
"start_col": 0,
"start_line": 124
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0)
unfold
let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)
let bind (a:Type) (b:Type) (st:Type0)
(wp_c : wp st a)
(wp_f : a -> wp st b)
(c : repr a st wp_c)
(f : (x:a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f)
= fun s0 ->
//let (y, s1) = c s0 in
//f y s1
// GM: argh! using the match above introduces noise in the VC, a true precondition
// that becomes a pain since we don't have monotonicity nor even extensionality
let r = c s0 in
f (fst r) (snd r)
let ite_wp #a #st (b:bool) (w1 w2 : wp st a) : wp st a =
fun s0 p -> (b ==> w1 s0 p) /\ ((~b) ==> w2 s0 p)
let if_then_else
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(f : repr a st wpf)
(g : repr a st wpg)
(b : bool)
: Type
= repr a st (ite_wp b wpf wpg)
let stronger
(#a:Type) (#st:Type0)
(w1 w2 : wp st a)
: Type0
= forall s0 p. w1 s0 p ==> w2 s0 p
let subcomp
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(#[@@@ refine] u : squash (stronger wpg wpf))
(f : repr a st wpf)
: repr a st wpg
= f
total
reifiable
reflectable
effect {
ST (a:Type) ([@@@ effect_param] st:Type0) (_:wp st a)
with {repr; return; bind; subcomp; if_then_else}
}
let lift_id_st_wp #a #st (w : ID5.wp a) : wp st a =
elim_pure_wp_monotonicity_forall ();
fun s0 p -> w (fun x -> p x s0)
let lift_id_st a wp st (f : ID5.repr a wp)
: repr a st (lift_id_st_wp wp)
= fun s0 -> ID5.ID?.reflect (ID5.bind _ _ _ _ f (fun x -> ID5.return _ (x, s0)))
sub_effect ID ~> ST = lift_id_st
let null #st #a : wp st a =
fun s0 p -> forall x s1. p x s1
let get #st () : ST st st (fun s0 p -> p s0 s0) =
ST?.reflect (fun s0 -> (s0, s0)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: st -> DM4F_layered5.ST Prims.unit | DM4F_layered5.ST | [] | [] | [
"FStar.Pervasives.Native.Mktuple2",
"Prims.unit",
"FStar.Pervasives.Native.tuple2"
] | [] | false | true | false | false | false | let put #st (s: st) : ST unit st (fun _ p -> p () s) =
| ST?.reflect (fun _ -> ((), s)) | false |
DM4F_layered5.fst | DM4F_layered5.test | val test: Prims.unit -> ST int int null | val test: Prims.unit -> ST int int null | let test () : ST int int null =
let x = get () in
put (x + x);
get () + get () | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 17,
"end_line": 131,
"start_col": 0,
"start_line": 128
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0)
unfold
let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)
let bind (a:Type) (b:Type) (st:Type0)
(wp_c : wp st a)
(wp_f : a -> wp st b)
(c : repr a st wp_c)
(f : (x:a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f)
= fun s0 ->
//let (y, s1) = c s0 in
//f y s1
// GM: argh! using the match above introduces noise in the VC, a true precondition
// that becomes a pain since we don't have monotonicity nor even extensionality
let r = c s0 in
f (fst r) (snd r)
let ite_wp #a #st (b:bool) (w1 w2 : wp st a) : wp st a =
fun s0 p -> (b ==> w1 s0 p) /\ ((~b) ==> w2 s0 p)
let if_then_else
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(f : repr a st wpf)
(g : repr a st wpg)
(b : bool)
: Type
= repr a st (ite_wp b wpf wpg)
let stronger
(#a:Type) (#st:Type0)
(w1 w2 : wp st a)
: Type0
= forall s0 p. w1 s0 p ==> w2 s0 p
let subcomp
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(#[@@@ refine] u : squash (stronger wpg wpf))
(f : repr a st wpf)
: repr a st wpg
= f
total
reifiable
reflectable
effect {
ST (a:Type) ([@@@ effect_param] st:Type0) (_:wp st a)
with {repr; return; bind; subcomp; if_then_else}
}
let lift_id_st_wp #a #st (w : ID5.wp a) : wp st a =
elim_pure_wp_monotonicity_forall ();
fun s0 p -> w (fun x -> p x s0)
let lift_id_st a wp st (f : ID5.repr a wp)
: repr a st (lift_id_st_wp wp)
= fun s0 -> ID5.ID?.reflect (ID5.bind _ _ _ _ f (fun x -> ID5.return _ (x, s0)))
sub_effect ID ~> ST = lift_id_st
let null #st #a : wp st a =
fun s0 p -> forall x s1. p x s1
let get #st () : ST st st (fun s0 p -> p s0 s0) =
ST?.reflect (fun s0 -> (s0, s0))
let put #st (s:st) : ST unit st (fun _ p -> p () s) =
ST?.reflect (fun _ -> ((), s)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> DM4F_layered5.ST Prims.int | DM4F_layered5.ST | [] | [] | [
"Prims.unit",
"Prims.op_Addition",
"Prims.int",
"DM4F_layered5.get",
"DM4F_layered5.put",
"DM4F_layered5.null"
] | [] | false | true | false | false | false | let test () : ST int int null =
| let x = get () in
put (x + x);
get () + get () | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.simplify_post | val simplify_post
(#g: env)
(#t: st_term)
(#c: comp_st)
(d: st_typing g t c)
(post: term{comp_post c == tm_star post tm_emp})
: st_typing g t (comp_st_with_post c post) | val simplify_post
(#g: env)
(#t: st_term)
(#c: comp_st)
(d: st_typing g t c)
(post: term{comp_post c == tm_star post tm_emp})
: st_typing g t (comp_st_with_post c post) | let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { comp_post c == tm_star post tm_emp})
: st_typing g t (comp_st_with_post c post)
= st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 111,
"end_line": 270,
"start_col": 0,
"start_line": 267
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r
let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res)
let comp_st_with_post (c:comp_st) (post:term)
: c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } =
match c with
| C_ST st -> C_ST { st with post }
| C_STGhost st -> C_STGhost { st with post }
| C_STAtomic i obs st -> C_STAtomic i obs {st with post}
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)
: option (st_equiv g c0 c2)
=
match d01 with
| ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 -> (
let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in
if x = y && eq_tm (comp_res c0) (comp_res c1)
then Some (
ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing
(RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)
(VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)
(VE_Trans _ _ _ _ eq_post_01 eq_post_12)
)
else None
)
| ST_TotEquiv g t1 t2 u typing eq ->
let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in
let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in
Some (ST_TotEquiv g t1 t3 u typing eq'')
let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c')
: st_typing g st c'
= match d with
| T_Equiv _ _ _ _ d0 eq' -> (
match st_equiv_trans eq' eq with
| None -> T_Equiv _ _ _ _ d eq
| Some eq'' -> T_Equiv _ _ _ _ d0 eq''
)
| _ -> T_Equiv _ _ _ _ d eq
let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { freevars post `Set.subset` freevars (comp_post c)})
(veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } ->
vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post)
= if eq_tm post (comp_post c) then d
else
let c' = comp_st_with_post c post in
let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let veq = veq x in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq
in
t_equiv d st_equiv | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
d: Pulse.Typing.st_typing g t c ->
post:
Pulse.Syntax.Base.term
{Pulse.Syntax.Base.comp_post c == Pulse.Syntax.Base.tm_star post Pulse.Syntax.Base.tm_emp}
-> Pulse.Typing.st_typing g t (Pulse.Checker.Base.comp_st_with_post c post) | Prims.Tot | [
"total"
] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp_st",
"Pulse.Typing.st_typing",
"Pulse.Syntax.Base.term",
"Prims.eq2",
"Pulse.Syntax.Base.comp_post",
"Pulse.Syntax.Base.tm_star",
"Pulse.Syntax.Base.tm_emp",
"Pulse.Checker.Base.st_equiv_post",
"Pulse.Syntax.Base.var",
"Pulse.Typing.fresh_wrt",
"Pulse.Syntax.Naming.freevars",
"Pulse.Checker.Base.ve_unit_r",
"Pulse.Typing.Env.push_binding",
"Pulse.Syntax.Base.ppname_default",
"Pulse.Syntax.Base.comp_res",
"Pulse.Syntax.Naming.open_term",
"Pulse.Typing.vprop_equiv",
"Pulse.Checker.Base.comp_st_with_post"
] | [] | false | false | false | false | false | let simplify_post
(#g: env)
(#t: st_term)
(#c: comp_st)
(d: st_typing g t c)
(post: term{comp_post c == tm_star post tm_emp})
: st_typing g t (comp_st_with_post c post) =
| st_equiv_post d
post
(fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Mov64 | val eval_Mov64 (src: nat64) : option nat64 | val eval_Mov64 (src: nat64) : option nat64 | let eval_Mov64 (src:nat64) : option nat64 = Some src | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 52,
"end_line": 13,
"start_col": 0,
"start_line": 13
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | src: Vale.X64.Machine_s.nat64 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.nat64 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Mov64 (src: nat64) : option nat64 =
| Some src | false |
Vale.AES.X64.GCMdecryptOpt.fst | Vale.AES.X64.GCMdecryptOpt.va_qcode_Gcm_extra_bytes | val va_qcode_Gcm_extra_bytes
(va_mods: va_mods_t)
(alg: algorithm)
(inout_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(total_bytes: nat)
(old_hash: quad32)
(completed_quads: (seq quad32))
(h_LE: quad32)
: (va_quickCode unit (va_code_Gcm_extra_bytes alg)) | val va_qcode_Gcm_extra_bytes
(va_mods: va_mods_t)
(alg: algorithm)
(inout_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(total_bytes: nat)
(old_hash: quad32)
(completed_quads: (seq quad32))
(h_LE: quad32)
: (va_quickCode unit (va_code_Gcm_extra_bytes alg)) | let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat)
(old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit
(va_code_Gcm_extra_bytes alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range
1 1)) = 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRax) 0 Secret inout_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let
(hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s)
inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key
round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax)
(va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (())))))))))))))) | {
"file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 87,
"end_line": 112,
"start_col": 0,
"start_line": 76
} | module Vale.AES.X64.GCMdecryptOpt
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GCM
open Vale.AES.GHash_s
open Vale.AES.GHash
open Vale.AES.GCM_s
open Vale.AES.X64.AES
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.Poly1305.Math
open Vale.AES.GCM_helpers
open Vale.AES.X64.GHash
open Vale.AES.X64.GCTR
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsStack
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.X64.GF128_Mul
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2.Bits_s
open Vale.AES.X64.AESopt
open Vale.AES.X64.AESGCM
open Vale.AES.X64.AESopt2
open Vale.Lib.Meta
open Vale.AES.X64.GCMencryptOpt
open Vale.AES.OptPublic
open Vale.Lib.Basic
#reset-options "--z3rlimit 20 --max_ifuel 0"
//-- Gcm_extra_bytes
val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_extra_bytes alg =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0)
(va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor
(va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_CNil ()))))))))))
val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_extra_bytes alg =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and
(va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_ttrue ()))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Lib.Basic.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.GHash.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESopt.fsti.checked",
"Vale.AES.X64.AESGCM.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.GCM.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GCMdecryptOpt.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Lib.Basic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_mods: Vale.X64.QuickCode.va_mods_t ->
alg: Vale.AES.AES_common_s.algorithm ->
inout_b: Vale.X64.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
total_bytes: Prims.nat ->
old_hash: Vale.X64.Decls.quad32 ->
completed_quads: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
h_LE: Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Prims.unit
(Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_extra_bytes alg) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.QuickCode.va_mods_t",
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Prims.nat",
"Vale.X64.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.X64.Decls.va_code",
"Vale.X64.InsVector.va_code_Load128_buffer",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.InsVector.va_code_Mov128",
"Vale.AES.X64.GCMencryptOpt.va_code_Ghash_extra_bytes",
"Vale.X64.InsVector.va_code_Pshufb",
"Vale.AES.X64.AES.va_code_AESEncryptBlock",
"Vale.X64.InsVector.va_code_Pxor",
"Vale.X64.InsVector.va_code_Store128_buffer",
"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.InsVector.va_quick_Load128_buffer",
"Vale.X64.QuickCodes.va_QBind",
"Vale.X64.InsVector.va_quick_Mov128",
"Vale.AES.X64.GCMencryptOpt.va_quick_Ghash_extra_bytes",
"Vale.X64.QuickCodes.va_qAssert",
"FStar.Seq.Base.equal",
"Vale.X64.Decls.s128",
"Vale.X64.Decls.va_get_mem_heaplet",
"FStar.Seq.Base.create",
"Vale.X64.InsVector.va_quick_Pshufb",
"Vale.AES.X64.AES.va_quick_AESEncryptBlock",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.X64.Decls.va_get_xmm",
"Vale.X64.QuickCodes.va_qPURE",
"Prims.pure_post",
"Prims.l_and",
"Prims.l_True",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.eq2",
"Vale.Def.Words_s.nat32",
"Vale.Def.Types_s.quad32",
"Vale.AES.AES_s.is_aes_key_LE",
"Vale.AES.AES_s.aes_encrypt_LE",
"Vale.AES.AES_s.aes_encrypt_LE_def",
"Vale.AES.AES_s.aes_encrypt_LE_reveal",
"Vale.X64.InsVector.va_quick_Pxor",
"Vale.X64.InsVector.va_quick_Store128_buffer",
"Vale.Def.Prop_s.prop0",
"Vale.AES.GCTR.gctr_partial",
"Vale.AES.GCTR.gctr_partial_def",
"Vale.AES.GCTR.gctr_partial_reveal",
"Vale.X64.QuickCodes.va_QEmpty",
"Vale.X64.QuickCodes.quickCodes",
"Vale.X64.Decls.va_int_range",
"Vale.X64.State.vale_state",
"Vale.X64.QuickCode.va_quickCode",
"Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_extra_bytes"
] | [] | false | false | false | false | false | let va_qcode_Gcm_extra_bytes
(va_mods: va_mods_t)
(alg: algorithm)
(inout_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(total_bytes: nat)
(old_hash: quad32)
(completed_quads: (seq quad32))
(h_LE: quad32)
: (va_quickCode unit (va_code_Gcm_extra_bytes alg)) =
| (qblock va_mods
(fun (va_s: va_state) ->
let va_old_s:va_state = va_s in
let len:(va_int_range 1 1) = 1 in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5)
(va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax)
0
Secret
inout_b
0)
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0))
(fun (va_s: va_state) _ ->
let hash_input:quad32 = va_get_xmm 0 va_s in
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads)
(fun (va_s: va_state) _ ->
va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.equal #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b)
(FStar.Seq.Base.create #quad32 1 hash_input))
(let snap:(FStar.Seq.Base.seq Vale.X64.Decls.quad32) =
Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b
in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9))
(fun (va_s: va_state) _ ->
va_QBind va_range1
"***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AESEncryptBlock alg
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11
va_s))
key
round_keys
keys_b)
(fun (va_s: va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_: unit) ->
Vale.AES.AES_s.aes_encrypt_LE_reveal ())
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pxor (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet
5)
(va_op_reg_opr64_reg64 rRax)
(va_op_xmm_xmm 10)
0
Secret
inout_b
0)
(fun (va_s: va_state) _ ->
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_: unit) ->
Vale.AES.GCTR.gctr_partial_reveal ()
)
(va_QEmpty (())))))))))))))) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Bswap64 | val eval_Bswap64 (dst: nat64) : option nat64 | val eval_Bswap64 (dst: nat64) : option nat64 | let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 76,
"end_line": 19,
"start_col": 0,
"start_line": 19
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Machine_s.nat64 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.nat64 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"FStar.Pervasives.Native.Some",
"Vale.Def.Types_s.reverse_bytes_nat64",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Bswap64 (dst: nat64) : option nat64 =
| Some (reverse_bytes_nat64 dst) | false |
DM4F_layered5.fst | DM4F_layered5.addx | val addx (x: int) : ST unit int (fun s0 p -> p () (s0 + x)) | val addx (x: int) : ST unit int (fun s0 p -> p () (s0 + x)) | let addx (x:int) : ST unit int (fun s0 p -> p () (s0+x)) =
let y = get () in
put (x+y) | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 11,
"end_line": 135,
"start_col": 0,
"start_line": 133
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0)
unfold
let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)
let bind (a:Type) (b:Type) (st:Type0)
(wp_c : wp st a)
(wp_f : a -> wp st b)
(c : repr a st wp_c)
(f : (x:a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f)
= fun s0 ->
//let (y, s1) = c s0 in
//f y s1
// GM: argh! using the match above introduces noise in the VC, a true precondition
// that becomes a pain since we don't have monotonicity nor even extensionality
let r = c s0 in
f (fst r) (snd r)
let ite_wp #a #st (b:bool) (w1 w2 : wp st a) : wp st a =
fun s0 p -> (b ==> w1 s0 p) /\ ((~b) ==> w2 s0 p)
let if_then_else
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(f : repr a st wpf)
(g : repr a st wpg)
(b : bool)
: Type
= repr a st (ite_wp b wpf wpg)
let stronger
(#a:Type) (#st:Type0)
(w1 w2 : wp st a)
: Type0
= forall s0 p. w1 s0 p ==> w2 s0 p
let subcomp
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(#[@@@ refine] u : squash (stronger wpg wpf))
(f : repr a st wpf)
: repr a st wpg
= f
total
reifiable
reflectable
effect {
ST (a:Type) ([@@@ effect_param] st:Type0) (_:wp st a)
with {repr; return; bind; subcomp; if_then_else}
}
let lift_id_st_wp #a #st (w : ID5.wp a) : wp st a =
elim_pure_wp_monotonicity_forall ();
fun s0 p -> w (fun x -> p x s0)
let lift_id_st a wp st (f : ID5.repr a wp)
: repr a st (lift_id_st_wp wp)
= fun s0 -> ID5.ID?.reflect (ID5.bind _ _ _ _ f (fun x -> ID5.return _ (x, s0)))
sub_effect ID ~> ST = lift_id_st
let null #st #a : wp st a =
fun s0 p -> forall x s1. p x s1
let get #st () : ST st st (fun s0 p -> p s0 s0) =
ST?.reflect (fun s0 -> (s0, s0))
let put #st (s:st) : ST unit st (fun _ p -> p () s) =
ST?.reflect (fun _ -> ((), s))
// this now works!!!
let test () : ST int int null =
let x = get () in
put (x + x);
get () + get () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: Prims.int -> DM4F_layered5.ST Prims.unit | DM4F_layered5.ST | [] | [] | [
"Prims.int",
"DM4F_layered5.put",
"Prims.op_Addition",
"Prims.unit",
"DM4F_layered5.get"
] | [] | false | true | false | false | false | let addx (x: int) : ST unit int (fun s0 p -> p () (s0 + x)) =
| let y = get () in
put (x + y) | false |
DM4F_layered5.fst | DM4F_layered5.get | val get: #st: _ -> Prims.unit -> ST st st (fun s0 p -> p s0 s0) | val get: #st: _ -> Prims.unit -> ST st st (fun s0 p -> p s0 s0) | let get #st () : ST st st (fun s0 p -> p s0 s0) =
ST?.reflect (fun s0 -> (s0, s0)) | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 34,
"end_line": 122,
"start_col": 0,
"start_line": 121
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0)
unfold
let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)
let bind (a:Type) (b:Type) (st:Type0)
(wp_c : wp st a)
(wp_f : a -> wp st b)
(c : repr a st wp_c)
(f : (x:a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f)
= fun s0 ->
//let (y, s1) = c s0 in
//f y s1
// GM: argh! using the match above introduces noise in the VC, a true precondition
// that becomes a pain since we don't have monotonicity nor even extensionality
let r = c s0 in
f (fst r) (snd r)
let ite_wp #a #st (b:bool) (w1 w2 : wp st a) : wp st a =
fun s0 p -> (b ==> w1 s0 p) /\ ((~b) ==> w2 s0 p)
let if_then_else
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(f : repr a st wpf)
(g : repr a st wpg)
(b : bool)
: Type
= repr a st (ite_wp b wpf wpg)
let stronger
(#a:Type) (#st:Type0)
(w1 w2 : wp st a)
: Type0
= forall s0 p. w1 s0 p ==> w2 s0 p
let subcomp
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(#[@@@ refine] u : squash (stronger wpg wpf))
(f : repr a st wpf)
: repr a st wpg
= f
total
reifiable
reflectable
effect {
ST (a:Type) ([@@@ effect_param] st:Type0) (_:wp st a)
with {repr; return; bind; subcomp; if_then_else}
}
let lift_id_st_wp #a #st (w : ID5.wp a) : wp st a =
elim_pure_wp_monotonicity_forall ();
fun s0 p -> w (fun x -> p x s0)
let lift_id_st a wp st (f : ID5.repr a wp)
: repr a st (lift_id_st_wp wp)
= fun s0 -> ID5.ID?.reflect (ID5.bind _ _ _ _ f (fun x -> ID5.return _ (x, s0)))
sub_effect ID ~> ST = lift_id_st
let null #st #a : wp st a =
fun s0 p -> forall x s1. p x s1 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> DM4F_layered5.ST st | DM4F_layered5.ST | [] | [] | [
"Prims.unit",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Pervasives.Native.tuple2"
] | [] | false | true | false | false | false | let get #st () : ST st st (fun s0 p -> p s0 s0) =
| ST?.reflect (fun s0 -> (s0, s0)) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Cmovc64 | val eval_Cmovc64 (dst src: nat64) (carry: bool) : option nat64 | val eval_Cmovc64 (dst src: nat64) (carry: bool) : option nat64 | let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 96,
"end_line": 22,
"start_col": 0,
"start_line": 22
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Machine_s.nat64 -> src: Vale.X64.Machine_s.nat64 -> carry: Prims.bool
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.nat64 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"Prims.bool",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Cmovc64 (dst src: nat64) (carry: bool) : option nat64 =
| Some (if carry then src else dst) | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.apply_checker_result_k | val apply_checker_result_k (#g:env) (#ctxt:vprop) (#post_hint:post_hint_for_env g)
(r:checker_result_t g ctxt (Some post_hint))
(res_ppname:ppname)
: T.Tac (st_typing_in_ctxt g ctxt (Some post_hint)) | val apply_checker_result_k (#g:env) (#ctxt:vprop) (#post_hint:post_hint_for_env g)
(r:checker_result_t g ctxt (Some post_hint))
(res_ppname:ppname)
: T.Tac (st_typing_in_ctxt g ctxt (Some post_hint)) | let apply_checker_result_k (#g:env) (#ctxt:vprop) (#post_hint:post_hint_for_env g)
(r:checker_result_t g ctxt (Some post_hint))
(res_ppname:ppname)
: T.Tac (st_typing_in_ctxt g ctxt (Some post_hint)) =
// TODO: FIXME add to checker result type?
let (| y, g1, (| u_ty, ty_y, d_ty_y |), (| pre', _ |), k |) = r in
let (| u_ty_y, d_ty_y |) = Pulse.Checker.Pure.check_universe g1 ty_y in
let d : st_typing_in_ctxt g1 pre' (Some post_hint) =
return_in_ctxt g1 y res_ppname u_ty_y ty_y pre' d_ty_y (Some post_hint) in
k (Some post_hint) d | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 22,
"end_line": 631,
"start_col": 0,
"start_line": 618
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r
let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res)
let comp_st_with_post (c:comp_st) (post:term)
: c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } =
match c with
| C_ST st -> C_ST { st with post }
| C_STGhost st -> C_STGhost { st with post }
| C_STAtomic i obs st -> C_STAtomic i obs {st with post}
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)
: option (st_equiv g c0 c2)
=
match d01 with
| ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 -> (
let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in
if x = y && eq_tm (comp_res c0) (comp_res c1)
then Some (
ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing
(RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)
(VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)
(VE_Trans _ _ _ _ eq_post_01 eq_post_12)
)
else None
)
| ST_TotEquiv g t1 t2 u typing eq ->
let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in
let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in
Some (ST_TotEquiv g t1 t3 u typing eq'')
let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c')
: st_typing g st c'
= match d with
| T_Equiv _ _ _ _ d0 eq' -> (
match st_equiv_trans eq' eq with
| None -> T_Equiv _ _ _ _ d eq
| Some eq'' -> T_Equiv _ _ _ _ d0 eq''
)
| _ -> T_Equiv _ _ _ _ d eq
let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { freevars post `Set.subset` freevars (comp_post c)})
(veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } ->
vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post)
= if eq_tm post (comp_post c) then d
else
let c' = comp_st_with_post c post in
let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let veq = veq x in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq
in
t_equiv d st_equiv
let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { comp_post c == tm_star post tm_emp})
: st_typing g t (comp_st_with_post c post)
= st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x))
let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t)
: Lemma
(requires
comp_post_matches_hint c post_hint /\
effect_annot_of_comp c == effect_annot_of_comp c' /\
comp_res c' == comp_res c /\
comp_u c' == comp_u c /\
comp_post c' == tm_star (comp_post c) tm_emp)
(ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\
comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c')
= ()
let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g p ctxt)
: tot_typing g p tm_vprop
= let _, bk = vprop_equiv_typing d in
bk ctxt_typing
let comp_with_pre (c:comp_st) (pre:term) =
match c with
| C_ST st -> C_ST { st with pre }
| C_STGhost st -> C_STGhost { st with pre }
| C_STAtomic i obs st -> C_STAtomic i obs {st with pre}
let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(pre:term)
(veq: vprop_equiv g (comp_pre c) pre)
: st_typing g t (comp_with_pre c pre)
= if eq_tm pre (comp_pre c) then d
else
let c' = comp_with_pre c pre in
let (| u_of, pre_typing, x, post_typing |) =
Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _)
in
t_equiv d st_equiv
#push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0"
let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term)
(k:continuation_elaborator g1 ctxt g2 ctxt1)
(d:vprop_equiv g2 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt g2 ctxt2 =
fun post_hint res ->
let (| st, c, st_d |) = res in
let st_d : st_typing g2 st c = st_d in
assert (comp_pre c == ctxt2);
let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in
k post_hint (| st, _, st_d' |)
#pop-options
let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g ctxt p)
: tot_typing g p tm_vprop
= let fwd, _ = vprop_equiv_typing d in
fwd ctxt_typing
#push-options "--z3rlimit_factor 4 --ifuel 1 --fuel 0"
let k_elab_equiv_prefix
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt)
(d:vprop_equiv g1 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt2 g2 ctxt =
fun post_hint res ->
let framing_token : frame_for_req_in_ctxt g1 ctxt2 ctxt1 =
let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in
(| tm_emp, emp_typing, d |)
in
let res = k post_hint res in
let (| st, c, st_d |) = res in
assert (comp_pre c == ctxt1);
(| _, _, st_equiv_pre st_d _ d |)
#pop-options
let k_elab_equiv
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt2)
(d1:vprop_equiv g1 ctxt1 ctxt1')
(d2:vprop_equiv g2 ctxt2 ctxt2')
: continuation_elaborator g1 ctxt1' g2 ctxt2' =
let k : continuation_elaborator g1 ctxt1 g2 ctxt2' =
k_elab_equiv_continuation k d2 in
let k : continuation_elaborator g1 ctxt1' g2 ctxt2' =
k_elab_equiv_prefix k d1 in
k
#push-options "--query_stats --fuel 2 --ifuel 2 --split_queries no --z3rlimit_factor 20"
open Pulse.PP
let continuation_elaborator_with_bind (#g:env) (ctxt:term)
(#c1:comp{stateful_comp c1})
(#e1:st_term)
(e1_typing:st_typing g e1 c1)
(ctxt_pre1_typing:tot_typing g (tm_star ctxt (comp_pre c1)) tm_vprop)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g
(tm_star ctxt (comp_pre c1))
(push_binding g (snd x) (fst x) (comp_res c1))
(tm_star (open_term (comp_post c1) (snd x)) ctxt)) =
let pre1 = comp_pre c1 in
let res1 = comp_res c1 in
let post1 = comp_post c1 in
let ctxt_typing = star_typing_inversion_l ctxt_pre1_typing in
// let p_prop = Metatheory.pure_typing_inversion pure_typing in
let v_eq = VE_Comm g ctxt pre1 in
let framing_token : frame_for_req_in_ctxt g (tm_star ctxt pre1) pre1 =
(| ctxt, ctxt_typing, VE_Comm g pre1 ctxt |)
in
let (| c1, e1_typing |) =
apply_frame ctxt_pre1_typing e1_typing framing_token in
let (| u_of_1, pre_typing, _, _ |) =
Metatheory.(st_comp_typing_inversion (fst <| comp_typing_inversion (st_typing_correctness e1_typing))) in
let b = res1 in
let ppname, x = x in
let g' = push_binding g x ppname b in
let post1_opened = open_term_nv post1 (v_as_nv x) in
let k : continuation_elaborator g (tm_star ctxt pre1) g' (tm_star post1_opened ctxt) =
fun post_hint res ->
let (| e2, c2, e2_typing |) = res in
assert (comp_post_matches_hint c2 post_hint);
let e2_typing : st_typing g' e2 c2 = e2_typing in
let e2_closed = close_st_term e2 x in
assume (open_st_term e2_closed x == e2);
assert (comp_pre c1 == (tm_star ctxt pre1));
assert (comp_post c1 == tm_star post1 ctxt);
assert (comp_pre c2 == tm_star post1_opened ctxt);
assert (open_term (comp_post c1) x == tm_star post1_opened (open_term ctxt x));
// ctxt is well-typed, hence ln
assume (open_term ctxt x == ctxt);
assert (open_term (comp_post c1) x == comp_pre c2);
// we closed e2 with x
assume (~ (x `Set.mem` freevars_st e2_closed));
if x `Set.mem` freevars (comp_post c2)
then fail g' None "Impossible: freevar clash when constructing continuation elaborator for bind, please file a bug-report"
else (
let t_typing, post_typing =
Pulse.Typing.Combinators.bind_res_and_post_typing g c2 x post_hint in
let g = push_context g "mk_bind" e1.range in
// info_doc g None
// [prefix 4 1 (doc_of_string "mk_bind e1 = ") (doc_of_string (Pulse.Syntax.Printer.st_term_to_string e1));
// prefix 4 1 (doc_of_string "mk_bind c1 = ") (pp #comp c1);
// prefix 4 1 (doc_of_string "mk_bind e2 = ") (doc_of_string (Pulse.Syntax.Printer.st_term_to_string e2));
// prefix 4 1 (doc_of_string "mk_bind c2 = ") (pp #comp c2)]
// ;
let (| e, c, e_typing |) =
Pulse.Typing.Combinators.mk_bind
g (tm_star ctxt pre1)
e1 e2_closed c1 c2 (ppname, x) e1_typing
u_of_1
e2_typing
t_typing
post_typing
(Some? post_hint)
in
(| e, c, e_typing |)
)
in
k
#pop-options
module LN = Pulse.Typing.LN
#push-options "--z3rlimit_factor 4 --fuel 1 --ifuel 1"
let st_comp_typing_with_post_hint
(#g:env) (#ctxt:_)
(ctxt_typing:tot_typing g ctxt tm_vprop)
(post_hint:post_hint_opt g { Some? post_hint })
(c:comp_st { comp_pre c == ctxt /\ comp_post_matches_hint c post_hint })
: st_comp_typing g (st_comp_of_comp c)
= let st = st_comp_of_comp c in
let Some ph = post_hint in
let post_typing_src
: tot_typing (push_binding ph.g ph.x ppname_default ph.ret_ty)
(open_term ph.post ph.x) tm_vprop
= ph.post_typing_src
in
let x = fresh g in
assume (fresh_wrt x g (freevars ph.post));
assume (None? (lookup g ph.x));
let post_typing_src
: tot_typing (push_binding ph.g x ppname_default ph.ret_ty)
(open_term ph.post x) tm_vprop
= if x = ph.x
then post_typing_src
else
let open Pulse.Typing.Metatheory.Base in
let tt :
tot_typing
(push_binding ph.g x ppname_default ph.ret_ty)
(subst_term (open_term ph.post ph.x) (renaming ph.x x))
(subst_term tm_vprop (renaming ph.x x)) =
tot_typing_renaming1 ph.g ph.x ph.ret_ty (open_term ph.post ph.x) tm_vprop post_typing_src x
in
assert (subst_term tm_vprop (renaming ph.x x) == tm_vprop);
assume (subst_term (open_term ph.post ph.x) (renaming ph.x x) ==
open_term ph.post x);
tt
in
let post_typing_src
: tot_typing (push_binding g x ppname_default ph.ret_ty)
(open_term ph.post x) tm_vprop
= //weakening: TODO
RU.magic ()
in
let ty_typing : universe_of ph.g st.res st.u = ph.ty_typing in
let ty_typing : universe_of g st.res st.u =
Pulse.Typing.Metatheory.tot_typing_weakening_standard ph.g ty_typing g
in
assert (st.res == ph.ret_ty);
assert (st.post == ph.post);
STC g st x ty_typing ctxt_typing post_typing_src
let continuation_elaborator_with_bind_fn (#g:env) (#ctxt:term)
(ctxt_typing:tot_typing g ctxt tm_vprop)
(#e1:st_term)
(#c1:comp { C_Tot? c1 })
(b:binder{b.binder_ty == comp_res c1})
(e1_typing:st_typing g e1 c1)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g ctxt
(push_binding g (snd x) ppname_default (comp_res c1)) ctxt)
= let t1 = comp_res c1 in
assert ((push_binding g (snd x) (fst x) t1) `env_extends` g);
fun post_hint (| e2, c2, d2 |) ->
if None? post_hint then T.fail "bind_fn: expects the post_hint to be set";
let ppname, x = x in
let e2_closed = close_st_term e2 x in
assume (open_st_term (close_st_term e2 x) x == e2);
let e = wr c2 (Tm_Bind {binder=b; head=e1; body=e2_closed}) in
let (| u, c1_typing |) = Pulse.Typing.Metatheory.Base.st_typing_correctness_ctot e1_typing in
let c2_typing : comp_typing g c2 (universe_of_comp c2) =
match c2 with
| C_ST st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
let i_typing = CP.core_check_term g i T.E_Total tm_inames in
CT_STAtomic _ _ obs _ i_typing stc
| C_STGhost st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
CT_STGhost _ _ stc
in
let d : st_typing g e c2 =
T_BindFn g e1 e2_closed c1 c2 b x e1_typing u c1_typing d2 c2_typing
in
(| e, c2, d |)
let rec check_equiv_emp (g:env) (vp:term)
: option (vprop_equiv g vp tm_emp)
= match vp.t with
| Tm_Emp -> Some (VE_Refl _ _)
| Tm_Star vp1 vp2 ->
(match check_equiv_emp g vp1, check_equiv_emp g vp2 with
| Some d1, Some d2 ->
let d3 : vprop_equiv g (tm_star vp1 vp2) (tm_star tm_emp tm_emp)
= VE_Ctxt _ _ _ _ _ d1 d2 in
let d4 : vprop_equiv g (tm_star tm_emp tm_emp) tm_emp =
VE_Unit _ _ in
Some (VE_Trans _ _ _ _ d3 d4)
| _, _ -> None)
| _ -> None
let emp_inames_included (g:env) (i:term) (_:tot_typing g i tm_inames)
: prop_validity g (tm_inames_subset tm_emp_inames i)
= RU.magic()
let return_in_ctxt (g:env) (y:var) (y_ppname:ppname) (u:universe) (ty:term) (ctxt:vprop)
(ty_typing:universe_of g ty u)
(post_hint0:post_hint_opt g { Some? post_hint0 /\ checker_res_matches_post_hint g post_hint0 y ty ctxt})
: Pure (st_typing_in_ctxt g ctxt post_hint0)
(requires lookup g y == Some ty)
(ensures fun _ -> True)
= let Some post_hint = post_hint0 in
let x = fresh g in
assume (~ (x `Set.mem` freevars post_hint.post));
let ctag =
match post_hint.effect_annot with
| EffectAnnotAtomic _ -> STT_Atomic
| EffectAnnotGhost -> STT_Ghost
| _ -> STT
in
let y_tm = tm_var {nm_index=y;nm_ppname=y_ppname} in
let d = T_Return g ctag false u ty y_tm post_hint.post x ty_typing
(RU.magic ()) // that null_var y is well typed at ty in g, we know since lookup g y == Some ty
(RU.magic ()) // typing of (open post x) in (g, x) ... post_hint is well-typed, so should get
in
let t = wtag (Some ctag) (Tm_Return {expected_type=tm_unknown;insert_eq=false;term=y_tm}) in
let c = comp_return ctag false u ty y_tm post_hint.post x in
let d : st_typing g t c = d in
assume (comp_u c == post_hint.u); // this u should follow from equality of t
match c, post_hint.effect_annot with
| C_STAtomic _ obs _, EffectAnnotAtomic { opens } ->
assert (comp_inames c == tm_emp_inames);
let pht = post_hint_typing g post_hint x in
let validity = emp_inames_included g opens pht.effect_annot_typing in
let d = T_Sub _ _ _ _ d (STS_AtomicInvs _ (st_comp_of_comp c) tm_emp_inames opens obs obs validity) in
(| _, _, d |)
| _ ->
(| _, _, d |)
let match_comp_res_with_post_hint (#g:env) (#t:st_term) (#c:comp_st)
(d:st_typing g t c)
(post_hint:post_hint_opt g)
: T.Tac (t':st_term &
c':comp_st &
st_typing g t' c') =
match post_hint with
| None -> (| t, c, d |)
| Some { ret_ty } ->
let cres = comp_res c in
if eq_tm cres ret_ty
then (| t, c, d |)
else match Pulse.Checker.Pure.check_equiv g cres ret_ty with
| None ->
fail g (Some t.range)
(Printf.sprintf "Could not prove equiv for computed type %s and expected type %s"
(P.term_to_string cres)
(P.term_to_string ret_ty))
| Some tok ->
let d_equiv
: RT.equiv _ (elab_term cres) (elab_term ret_ty) =
RT.Rel_eq_token _ _ _ (FStar.Squash.return_squash tok) in
let c' = with_st_comp c {(st_comp_of_comp c) with res = ret_ty } in
let (| cres_typing, cpre_typing, x, cpost_typing |) =
st_comp_typing_inversion (fst <| comp_typing_inversion (st_typing_correctness d)) in
let d_stequiv : st_equiv g c c' =
ST_VPropEquiv _ c c' _ cpre_typing cres_typing cpost_typing d_equiv (VE_Refl _ _) (VE_Refl _ _)
in
(| t, c', T_Equiv _ _ _ _ d d_stequiv |) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Typing.LN",
"short_module": "LN"
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
r: Pulse.Checker.Base.checker_result_t g ctxt (FStar.Pervasives.Native.Some post_hint) ->
res_ppname: Pulse.Syntax.Base.ppname
-> FStar.Tactics.Effect.Tac
(Pulse.Typing.Combinators.st_typing_in_ctxt g ctxt (FStar.Pervasives.Native.Some post_hint)) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.vprop",
"Pulse.Typing.post_hint_for_env",
"Pulse.Checker.Base.checker_result_t",
"FStar.Pervasives.Native.Some",
"Pulse.Typing.post_hint_t",
"Pulse.Syntax.Base.ppname",
"Pulse.Syntax.Base.var",
"Pulse.Typing.Env.env_extends",
"Pulse.Syntax.Base.universe",
"Pulse.Syntax.Base.typ",
"Pulse.Typing.universe_of",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Checker.Base.continuation_elaborator",
"FStar.Pervasives.dfst",
"Prims.Mkdtuple2",
"Pulse.Checker.Base.checker_result_inv",
"FStar.Pervasives.Mkdtuple3",
"Pulse.Typing.Combinators.st_typing_in_ctxt",
"Pulse.Checker.Base.return_in_ctxt",
"Prims.dtuple2",
"Pulse.Checker.Pure.check_universe"
] | [] | false | true | false | false | false | let apply_checker_result_k
(#g: env)
(#ctxt: vprop)
(#post_hint: post_hint_for_env g)
(r: checker_result_t g ctxt (Some post_hint))
(res_ppname: ppname)
: T.Tac (st_typing_in_ctxt g ctxt (Some post_hint)) =
| let (| y , g1 , (| u_ty , ty_y , d_ty_y |) , (| pre' , _ |) , k |) = r in
let (| u_ty_y , d_ty_y |) = Pulse.Checker.Pure.check_universe g1 ty_y in
let d:st_typing_in_ctxt g1 pre' (Some post_hint) =
return_in_ctxt g1 y res_ppname u_ty_y ty_y pre' d_ty_y (Some post_hint)
in
k (Some post_hint) d | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.norm_typing | val norm_typing
(g:env) (e:term) (eff:_) (t0:term)
(d:typing g e eff t0)
(steps:list norm_step)
: T.Tac (t':term & typing g e eff t') | val norm_typing
(g:env) (e:term) (eff:_) (t0:term)
(d:typing g e eff t0)
(steps:list norm_step)
: T.Tac (t':term & typing g e eff t') | let norm_typing
(g:env) (e:term) (eff:_) (t0:term)
(d:typing g e eff t0)
(steps:list norm_step)
: T.Tac (t':term & typing g e eff t')
= let t = elab_term t0 in
let u_t_typing : Ghost.erased (u:R.universe & RT.typing _ _ _) =
Pulse.Typing.Metatheory.Base.typing_correctness d._0
in
let (| t', t'_typing, related_t_t' |) =
Pulse.RuntimeUtils.norm_well_typed_term (dsnd u_t_typing) steps
in
match Pulse.Readback.readback_ty t' with
| None -> T.fail "Could not readback normalized type"
| Some t'' ->
let d : typing g e eff t'' = apply_conversion d related_t_t' in
(| t'', d |) | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 18,
"end_line": 802,
"start_col": 0,
"start_line": 786
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r
let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res)
let comp_st_with_post (c:comp_st) (post:term)
: c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } =
match c with
| C_ST st -> C_ST { st with post }
| C_STGhost st -> C_STGhost { st with post }
| C_STAtomic i obs st -> C_STAtomic i obs {st with post}
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)
: option (st_equiv g c0 c2)
=
match d01 with
| ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 -> (
let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in
if x = y && eq_tm (comp_res c0) (comp_res c1)
then Some (
ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing
(RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)
(VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)
(VE_Trans _ _ _ _ eq_post_01 eq_post_12)
)
else None
)
| ST_TotEquiv g t1 t2 u typing eq ->
let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in
let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in
Some (ST_TotEquiv g t1 t3 u typing eq'')
let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c')
: st_typing g st c'
= match d with
| T_Equiv _ _ _ _ d0 eq' -> (
match st_equiv_trans eq' eq with
| None -> T_Equiv _ _ _ _ d eq
| Some eq'' -> T_Equiv _ _ _ _ d0 eq''
)
| _ -> T_Equiv _ _ _ _ d eq
let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { freevars post `Set.subset` freevars (comp_post c)})
(veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } ->
vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post)
= if eq_tm post (comp_post c) then d
else
let c' = comp_st_with_post c post in
let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let veq = veq x in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq
in
t_equiv d st_equiv
let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { comp_post c == tm_star post tm_emp})
: st_typing g t (comp_st_with_post c post)
= st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x))
let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t)
: Lemma
(requires
comp_post_matches_hint c post_hint /\
effect_annot_of_comp c == effect_annot_of_comp c' /\
comp_res c' == comp_res c /\
comp_u c' == comp_u c /\
comp_post c' == tm_star (comp_post c) tm_emp)
(ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\
comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c')
= ()
let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g p ctxt)
: tot_typing g p tm_vprop
= let _, bk = vprop_equiv_typing d in
bk ctxt_typing
let comp_with_pre (c:comp_st) (pre:term) =
match c with
| C_ST st -> C_ST { st with pre }
| C_STGhost st -> C_STGhost { st with pre }
| C_STAtomic i obs st -> C_STAtomic i obs {st with pre}
let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(pre:term)
(veq: vprop_equiv g (comp_pre c) pre)
: st_typing g t (comp_with_pre c pre)
= if eq_tm pre (comp_pre c) then d
else
let c' = comp_with_pre c pre in
let (| u_of, pre_typing, x, post_typing |) =
Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _)
in
t_equiv d st_equiv
#push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0"
let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term)
(k:continuation_elaborator g1 ctxt g2 ctxt1)
(d:vprop_equiv g2 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt g2 ctxt2 =
fun post_hint res ->
let (| st, c, st_d |) = res in
let st_d : st_typing g2 st c = st_d in
assert (comp_pre c == ctxt2);
let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in
k post_hint (| st, _, st_d' |)
#pop-options
let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g ctxt p)
: tot_typing g p tm_vprop
= let fwd, _ = vprop_equiv_typing d in
fwd ctxt_typing
#push-options "--z3rlimit_factor 4 --ifuel 1 --fuel 0"
let k_elab_equiv_prefix
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt)
(d:vprop_equiv g1 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt2 g2 ctxt =
fun post_hint res ->
let framing_token : frame_for_req_in_ctxt g1 ctxt2 ctxt1 =
let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in
(| tm_emp, emp_typing, d |)
in
let res = k post_hint res in
let (| st, c, st_d |) = res in
assert (comp_pre c == ctxt1);
(| _, _, st_equiv_pre st_d _ d |)
#pop-options
let k_elab_equiv
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt2)
(d1:vprop_equiv g1 ctxt1 ctxt1')
(d2:vprop_equiv g2 ctxt2 ctxt2')
: continuation_elaborator g1 ctxt1' g2 ctxt2' =
let k : continuation_elaborator g1 ctxt1 g2 ctxt2' =
k_elab_equiv_continuation k d2 in
let k : continuation_elaborator g1 ctxt1' g2 ctxt2' =
k_elab_equiv_prefix k d1 in
k
#push-options "--query_stats --fuel 2 --ifuel 2 --split_queries no --z3rlimit_factor 20"
open Pulse.PP
let continuation_elaborator_with_bind (#g:env) (ctxt:term)
(#c1:comp{stateful_comp c1})
(#e1:st_term)
(e1_typing:st_typing g e1 c1)
(ctxt_pre1_typing:tot_typing g (tm_star ctxt (comp_pre c1)) tm_vprop)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g
(tm_star ctxt (comp_pre c1))
(push_binding g (snd x) (fst x) (comp_res c1))
(tm_star (open_term (comp_post c1) (snd x)) ctxt)) =
let pre1 = comp_pre c1 in
let res1 = comp_res c1 in
let post1 = comp_post c1 in
let ctxt_typing = star_typing_inversion_l ctxt_pre1_typing in
// let p_prop = Metatheory.pure_typing_inversion pure_typing in
let v_eq = VE_Comm g ctxt pre1 in
let framing_token : frame_for_req_in_ctxt g (tm_star ctxt pre1) pre1 =
(| ctxt, ctxt_typing, VE_Comm g pre1 ctxt |)
in
let (| c1, e1_typing |) =
apply_frame ctxt_pre1_typing e1_typing framing_token in
let (| u_of_1, pre_typing, _, _ |) =
Metatheory.(st_comp_typing_inversion (fst <| comp_typing_inversion (st_typing_correctness e1_typing))) in
let b = res1 in
let ppname, x = x in
let g' = push_binding g x ppname b in
let post1_opened = open_term_nv post1 (v_as_nv x) in
let k : continuation_elaborator g (tm_star ctxt pre1) g' (tm_star post1_opened ctxt) =
fun post_hint res ->
let (| e2, c2, e2_typing |) = res in
assert (comp_post_matches_hint c2 post_hint);
let e2_typing : st_typing g' e2 c2 = e2_typing in
let e2_closed = close_st_term e2 x in
assume (open_st_term e2_closed x == e2);
assert (comp_pre c1 == (tm_star ctxt pre1));
assert (comp_post c1 == tm_star post1 ctxt);
assert (comp_pre c2 == tm_star post1_opened ctxt);
assert (open_term (comp_post c1) x == tm_star post1_opened (open_term ctxt x));
// ctxt is well-typed, hence ln
assume (open_term ctxt x == ctxt);
assert (open_term (comp_post c1) x == comp_pre c2);
// we closed e2 with x
assume (~ (x `Set.mem` freevars_st e2_closed));
if x `Set.mem` freevars (comp_post c2)
then fail g' None "Impossible: freevar clash when constructing continuation elaborator for bind, please file a bug-report"
else (
let t_typing, post_typing =
Pulse.Typing.Combinators.bind_res_and_post_typing g c2 x post_hint in
let g = push_context g "mk_bind" e1.range in
// info_doc g None
// [prefix 4 1 (doc_of_string "mk_bind e1 = ") (doc_of_string (Pulse.Syntax.Printer.st_term_to_string e1));
// prefix 4 1 (doc_of_string "mk_bind c1 = ") (pp #comp c1);
// prefix 4 1 (doc_of_string "mk_bind e2 = ") (doc_of_string (Pulse.Syntax.Printer.st_term_to_string e2));
// prefix 4 1 (doc_of_string "mk_bind c2 = ") (pp #comp c2)]
// ;
let (| e, c, e_typing |) =
Pulse.Typing.Combinators.mk_bind
g (tm_star ctxt pre1)
e1 e2_closed c1 c2 (ppname, x) e1_typing
u_of_1
e2_typing
t_typing
post_typing
(Some? post_hint)
in
(| e, c, e_typing |)
)
in
k
#pop-options
module LN = Pulse.Typing.LN
#push-options "--z3rlimit_factor 4 --fuel 1 --ifuel 1"
let st_comp_typing_with_post_hint
(#g:env) (#ctxt:_)
(ctxt_typing:tot_typing g ctxt tm_vprop)
(post_hint:post_hint_opt g { Some? post_hint })
(c:comp_st { comp_pre c == ctxt /\ comp_post_matches_hint c post_hint })
: st_comp_typing g (st_comp_of_comp c)
= let st = st_comp_of_comp c in
let Some ph = post_hint in
let post_typing_src
: tot_typing (push_binding ph.g ph.x ppname_default ph.ret_ty)
(open_term ph.post ph.x) tm_vprop
= ph.post_typing_src
in
let x = fresh g in
assume (fresh_wrt x g (freevars ph.post));
assume (None? (lookup g ph.x));
let post_typing_src
: tot_typing (push_binding ph.g x ppname_default ph.ret_ty)
(open_term ph.post x) tm_vprop
= if x = ph.x
then post_typing_src
else
let open Pulse.Typing.Metatheory.Base in
let tt :
tot_typing
(push_binding ph.g x ppname_default ph.ret_ty)
(subst_term (open_term ph.post ph.x) (renaming ph.x x))
(subst_term tm_vprop (renaming ph.x x)) =
tot_typing_renaming1 ph.g ph.x ph.ret_ty (open_term ph.post ph.x) tm_vprop post_typing_src x
in
assert (subst_term tm_vprop (renaming ph.x x) == tm_vprop);
assume (subst_term (open_term ph.post ph.x) (renaming ph.x x) ==
open_term ph.post x);
tt
in
let post_typing_src
: tot_typing (push_binding g x ppname_default ph.ret_ty)
(open_term ph.post x) tm_vprop
= //weakening: TODO
RU.magic ()
in
let ty_typing : universe_of ph.g st.res st.u = ph.ty_typing in
let ty_typing : universe_of g st.res st.u =
Pulse.Typing.Metatheory.tot_typing_weakening_standard ph.g ty_typing g
in
assert (st.res == ph.ret_ty);
assert (st.post == ph.post);
STC g st x ty_typing ctxt_typing post_typing_src
let continuation_elaborator_with_bind_fn (#g:env) (#ctxt:term)
(ctxt_typing:tot_typing g ctxt tm_vprop)
(#e1:st_term)
(#c1:comp { C_Tot? c1 })
(b:binder{b.binder_ty == comp_res c1})
(e1_typing:st_typing g e1 c1)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g ctxt
(push_binding g (snd x) ppname_default (comp_res c1)) ctxt)
= let t1 = comp_res c1 in
assert ((push_binding g (snd x) (fst x) t1) `env_extends` g);
fun post_hint (| e2, c2, d2 |) ->
if None? post_hint then T.fail "bind_fn: expects the post_hint to be set";
let ppname, x = x in
let e2_closed = close_st_term e2 x in
assume (open_st_term (close_st_term e2 x) x == e2);
let e = wr c2 (Tm_Bind {binder=b; head=e1; body=e2_closed}) in
let (| u, c1_typing |) = Pulse.Typing.Metatheory.Base.st_typing_correctness_ctot e1_typing in
let c2_typing : comp_typing g c2 (universe_of_comp c2) =
match c2 with
| C_ST st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
let i_typing = CP.core_check_term g i T.E_Total tm_inames in
CT_STAtomic _ _ obs _ i_typing stc
| C_STGhost st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
CT_STGhost _ _ stc
in
let d : st_typing g e c2 =
T_BindFn g e1 e2_closed c1 c2 b x e1_typing u c1_typing d2 c2_typing
in
(| e, c2, d |)
let rec check_equiv_emp (g:env) (vp:term)
: option (vprop_equiv g vp tm_emp)
= match vp.t with
| Tm_Emp -> Some (VE_Refl _ _)
| Tm_Star vp1 vp2 ->
(match check_equiv_emp g vp1, check_equiv_emp g vp2 with
| Some d1, Some d2 ->
let d3 : vprop_equiv g (tm_star vp1 vp2) (tm_star tm_emp tm_emp)
= VE_Ctxt _ _ _ _ _ d1 d2 in
let d4 : vprop_equiv g (tm_star tm_emp tm_emp) tm_emp =
VE_Unit _ _ in
Some (VE_Trans _ _ _ _ d3 d4)
| _, _ -> None)
| _ -> None
let emp_inames_included (g:env) (i:term) (_:tot_typing g i tm_inames)
: prop_validity g (tm_inames_subset tm_emp_inames i)
= RU.magic()
let return_in_ctxt (g:env) (y:var) (y_ppname:ppname) (u:universe) (ty:term) (ctxt:vprop)
(ty_typing:universe_of g ty u)
(post_hint0:post_hint_opt g { Some? post_hint0 /\ checker_res_matches_post_hint g post_hint0 y ty ctxt})
: Pure (st_typing_in_ctxt g ctxt post_hint0)
(requires lookup g y == Some ty)
(ensures fun _ -> True)
= let Some post_hint = post_hint0 in
let x = fresh g in
assume (~ (x `Set.mem` freevars post_hint.post));
let ctag =
match post_hint.effect_annot with
| EffectAnnotAtomic _ -> STT_Atomic
| EffectAnnotGhost -> STT_Ghost
| _ -> STT
in
let y_tm = tm_var {nm_index=y;nm_ppname=y_ppname} in
let d = T_Return g ctag false u ty y_tm post_hint.post x ty_typing
(RU.magic ()) // that null_var y is well typed at ty in g, we know since lookup g y == Some ty
(RU.magic ()) // typing of (open post x) in (g, x) ... post_hint is well-typed, so should get
in
let t = wtag (Some ctag) (Tm_Return {expected_type=tm_unknown;insert_eq=false;term=y_tm}) in
let c = comp_return ctag false u ty y_tm post_hint.post x in
let d : st_typing g t c = d in
assume (comp_u c == post_hint.u); // this u should follow from equality of t
match c, post_hint.effect_annot with
| C_STAtomic _ obs _, EffectAnnotAtomic { opens } ->
assert (comp_inames c == tm_emp_inames);
let pht = post_hint_typing g post_hint x in
let validity = emp_inames_included g opens pht.effect_annot_typing in
let d = T_Sub _ _ _ _ d (STS_AtomicInvs _ (st_comp_of_comp c) tm_emp_inames opens obs obs validity) in
(| _, _, d |)
| _ ->
(| _, _, d |)
let match_comp_res_with_post_hint (#g:env) (#t:st_term) (#c:comp_st)
(d:st_typing g t c)
(post_hint:post_hint_opt g)
: T.Tac (t':st_term &
c':comp_st &
st_typing g t' c') =
match post_hint with
| None -> (| t, c, d |)
| Some { ret_ty } ->
let cres = comp_res c in
if eq_tm cres ret_ty
then (| t, c, d |)
else match Pulse.Checker.Pure.check_equiv g cres ret_ty with
| None ->
fail g (Some t.range)
(Printf.sprintf "Could not prove equiv for computed type %s and expected type %s"
(P.term_to_string cres)
(P.term_to_string ret_ty))
| Some tok ->
let d_equiv
: RT.equiv _ (elab_term cres) (elab_term ret_ty) =
RT.Rel_eq_token _ _ _ (FStar.Squash.return_squash tok) in
let c' = with_st_comp c {(st_comp_of_comp c) with res = ret_ty } in
let (| cres_typing, cpre_typing, x, cpost_typing |) =
st_comp_typing_inversion (fst <| comp_typing_inversion (st_typing_correctness d)) in
let d_stequiv : st_equiv g c c' =
ST_VPropEquiv _ c c' _ cpre_typing cres_typing cpost_typing d_equiv (VE_Refl _ _) (VE_Refl _ _)
in
(| t, c', T_Equiv _ _ _ _ d d_stequiv |)
let apply_checker_result_k (#g:env) (#ctxt:vprop) (#post_hint:post_hint_for_env g)
(r:checker_result_t g ctxt (Some post_hint))
(res_ppname:ppname)
: T.Tac (st_typing_in_ctxt g ctxt (Some post_hint)) =
// TODO: FIXME add to checker result type?
let (| y, g1, (| u_ty, ty_y, d_ty_y |), (| pre', _ |), k |) = r in
let (| u_ty_y, d_ty_y |) = Pulse.Checker.Pure.check_universe g1 ty_y in
let d : st_typing_in_ctxt g1 pre' (Some post_hint) =
return_in_ctxt g1 y res_ppname u_ty_y ty_y pre' d_ty_y (Some post_hint) in
k (Some post_hint) d
#push-options "--z3rlimit_factor 4 --fuel 0 --ifuel 1 --query_stats"
let checker_result_for_st_typing (#g:env) (#ctxt:vprop) (#post_hint:post_hint_opt g)
(d:st_typing_in_ctxt g ctxt post_hint)
(ppname:ppname)
: T.Tac (checker_result_t g ctxt post_hint) =
let (| t, c, d |) = d in
let x = fresh g in
let g' = push_binding g x ppname (comp_res c) in
let ctxt' = open_term_nv (comp_post c) (ppname, x) in
let k
: continuation_elaborator
g (tm_star tm_emp (comp_pre c))
g' (tm_star ctxt' tm_emp) =
continuation_elaborator_with_bind tm_emp d (RU.magic ()) (ppname, x) in
let k
: continuation_elaborator g (comp_pre c) g' ctxt' =
k_elab_equiv k (RU.magic ()) (RU.magic ()) in
let _ : squash (checker_res_matches_post_hint g post_hint x (comp_res c) ctxt') =
match post_hint with
| None -> ()
| Some post_hint -> () in
assert (g' `env_extends` g);
let comp_res_typing, _, f =
Metatheory.(st_comp_typing_inversion_cofinite (fst <| comp_typing_inversion (st_typing_correctness d))) in
// RU.magic is the typing of comp_res in g'
// weaken comp_res_typing
assume (~ (x `Set.mem` freevars (comp_post c)));
let tt : universe_of _ _ _ = RU.magic () in
(| x, g', (| comp_u c, comp_res c, tt |), (| ctxt', f x |), k |)
#pop-options
module R = FStar.Reflection.V2
let readback_comp_res_as_comp (c:T.comp) : option comp =
match c with
| T.C_Total t -> (
match readback_comp t with
| None -> None
| Some c -> Some c
)
| _ -> None
let rec is_stateful_arrow (g:env) (c:option comp) (args:list T.argv) (out:list T.argv)
: T.Tac (option (list T.argv & T.argv))
= let open R in
match c with
| None -> None
| Some (C_ST _)
| Some (C_STGhost _)
| Some (C_STAtomic _ _ _) -> (
match args, out with
| [], hd::tl -> Some (List.rev tl, hd)
| _ -> None //leftover or not enough args
)
| Some (C_Tot c_res) -> (
if not (Tm_FStar? c_res.t)
then None
else (
let Tm_FStar c_res = c_res.t in
let ht = T.inspect c_res in
match ht with
| T.Tv_Arrow b c -> (
match args with
| [] -> ( //no more args; check that only implicits remain, ending in an stateful comp
let bs, c = T.collect_arr_ln_bs c_res in
if List.Tot.for_all (fun b -> R.Q_Implicit? (R.inspect_binder b).qual) bs
then is_stateful_arrow g (readback_comp_res_as_comp (R.inspect_comp c)) [] out
else None //too few args
)
| (arg, qual)::args' -> ( //check that this arg qual matches the binder and recurse accordingly
match b.qual, qual with
| T.Q_Meta _, T.Q_Implicit
| T.Q_Implicit, T.Q_Implicit
| T.Q_Explicit, T.Q_Explicit -> //consume this argument
is_stateful_arrow g (readback_comp_res_as_comp c) args' ((arg, qual)::out)
| T.Q_Meta _, T.Q_Explicit
| T.Q_Implicit, T.Q_Explicit ->
//don't consume this argument
is_stateful_arrow g (readback_comp_res_as_comp c) args out
| _ -> None //incompatible qualifiers; bail
)
)
| _ ->
let c_res' = RU.whnf_lax (elab_env g) c_res in
let ht = T.inspect c_res' in
if T.Tv_Arrow? ht
then (
assume (not_tv_unknown c_res');
let c_res' = tm_fstar c_res' (T.range_of_term c_res') in
is_stateful_arrow g (Some (C_Tot c_res')) args out
)
else None
)
)
module RU = Pulse.RuntimeUtils
let is_stateful_application (g:env) (e:term)
: T.Tac (option st_term)
= match e.t with
| Tm_FStar host_term -> (
let head, args = T.collect_app_ln host_term in
assume (not_tv_unknown head);
match RU.lax_check_term_with_unknown_universes (elab_env g) head with
| None -> None
| Some ht ->
assume (not_tv_unknown ht);
let head_t = tm_fstar ht (T.range_of_term ht) in
match is_stateful_arrow g (Some (C_Tot head_t)) args [] with
| None -> None
| Some (applied_args, (last_arg, aqual))->
let head = T.mk_app head applied_args in
assume (not_tv_unknown head);
let head = tm_fstar head (T.range_of_term head) in
assume (not_tv_unknown last_arg);
let last_arg = tm_fstar last_arg (T.range_of_term last_arg) in
let qual =
match aqual with
| T.Q_Implicit -> Some Implicit
| _ -> None
in
let st_app = Tm_STApp { head; arg=last_arg; arg_qual=qual} in
let st_app = { term = st_app; range=e.range; effect_tag=default_effect_hint } in
Some st_app
)
| _ -> None
let apply_conversion
(#g:env) (#e:term) (#eff:_) (#t0:term)
(d:typing g e eff t0)
(#t1:term)
(eq:Ghost.erased (RT.related (elab_env g) (elab_term t0) RT.R_Eq (elab_term t1)))
: typing g e eff t1
= let d : RT.typing (elab_env g) (elab_term e) (eff, (elab_term t0)) = d._0 in
let r : RT.related (elab_env g) (elab_term t0) RT.R_Eq (elab_term t1) = eq in
let r = RT.Rel_equiv _ _ _ RT.R_Sub r in
let s : RT.sub_comp (elab_env g) (eff, (elab_term t0)) (eff, elab_term t1) =
RT.Relc_typ _ _ _ _ _ r
in
E (RT.T_Sub _ _ _ _ d s) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Typing.LN",
"short_module": "LN"
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
g: Pulse.Typing.Env.env ->
e: Pulse.Syntax.Base.term ->
eff: FStar.Stubs.TypeChecker.Core.tot_or_ghost ->
t0: Pulse.Syntax.Base.term ->
d: Pulse.Typing.typing g e eff t0 ->
steps: Prims.list FStar.Pervasives.norm_step
-> FStar.Tactics.Effect.Tac
(Prims.dtuple2 Pulse.Syntax.Base.term (fun t' -> Pulse.Typing.typing g e eff t')) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"FStar.Stubs.TypeChecker.Core.tot_or_ghost",
"Pulse.Typing.typing",
"Prims.list",
"FStar.Pervasives.norm_step",
"FStar.Stubs.Reflection.Types.term",
"FStar.Ghost.erased",
"FStar.Reflection.Typing.typing",
"Pulse.Typing.elab_env",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Stubs.TypeChecker.Core.E_Total",
"FStar.Ghost.reveal",
"FStar.Ghost.hide",
"FStar.Reflection.Typing.tm_type",
"Prims.__proj__Mkdtuple2__item___1",
"FStar.Stubs.Reflection.Types.universe",
"Pulse.Elaborate.Pure.elab_term",
"Prims.dtuple2",
"FStar.Reflection.Typing.related",
"FStar.Reflection.Typing.R_Eq",
"Pulse.Readback.readback_ty",
"FStar.Tactics.V2.Derived.fail",
"Prims.eq2",
"Prims.Mkdtuple2",
"Pulse.Checker.Base.apply_conversion",
"FStar.Pervasives.dtuple3",
"Pulse.RuntimeUtils.norm_well_typed_term",
"FStar.Pervasives.dsnd",
"Pulse.Typing.Metatheory.Base.typing_correctness",
"Pulse.Typing.__proj__E__item___0"
] | [] | false | true | false | false | false | let norm_typing
(g: env)
(e: term)
(eff: _)
(t0: term)
(d: typing g e eff t0)
(steps: list norm_step)
: T.Tac (t': term & typing g e eff t') =
| let t = elab_term t0 in
let u_t_typing:Ghost.erased (u: R.universe & RT.typing _ _ _) =
Pulse.Typing.Metatheory.Base.typing_correctness d._0
in
let (| t' , t'_typing , related_t_t' |) =
Pulse.RuntimeUtils.norm_well_typed_term (dsnd u_t_typing) steps
in
match Pulse.Readback.readback_ty t' with
| None -> T.fail "Could not readback normalized type"
| Some t'' ->
let d:typing g e eff t'' = apply_conversion d related_t_t' in
(| t'', d |) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_MovBe64 | val eval_MovBe64 (src: nat64) : option nat64 | val eval_MovBe64 (src: nat64) : option nat64 | let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 108,
"end_line": 16,
"start_col": 0,
"start_line": 16
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | src: Vale.X64.Machine_s.nat64 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.nat64 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"Vale.X64.CPU_Features_s.movbe_enabled",
"FStar.Pervasives.Native.Some",
"Vale.Def.Types_s.reverse_bytes_nat64",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_MovBe64 (src: nat64) : option nat64 =
| if movbe_enabled then Some (reverse_bytes_nat64 src) else None | false |
DM4F_layered5.fst | DM4F_layered5.add_via_state | val add_via_state (x y: int) : ST int int (fun s0 p -> p (x + y) s0) | val add_via_state (x y: int) : ST int int (fun s0 p -> p (x + y) s0) | let add_via_state (x y : int) : ST int int (fun s0 p -> p (x+y) s0) =
let o = get () in
put x;
addx y;
let r = get () in
put o;
r | {
"file_name": "examples/layeredeffects/DM4F_layered5.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 3,
"end_line": 143,
"start_col": 0,
"start_line": 137
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module DM4F_layered5
(* Same as DM4F, but layered over a layered PURE without monotonicity *)
open ID5
open DM4F_Utils
unfold
let pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =
ID5.bind_wp w1 w2
(* Simulating state effect in DM4F, hopefully doable by a tactic. *)
type post_t st a = a -> st -> Type0
type wp0 (st:Type u#0) (a:Type u#ua) : Type u#(max 1 ua) =
st -> post_t st a -> Type0
let st_monotonic #st #a (w : wp0 st a) : Type0 =
//forall s0 p1 p2. (forall r. p1 r ==> p2 r) ==> w s0 p1 ==> w s0 p2
// ^ this version seems to be less SMT-friendly
forall s0 p1 p2. (forall x s1. p1 x s1 ==> p2 x s1) ==> w s0 p1 ==> w s0 p2
type wp st a = w:(wp0 st a){st_monotonic w}
open FStar.Monotonic.Pure
type repr (a:Type u#ua) (st:Type0) (wp : wp u#ua st a) : Type u#(max 1 ua) =
s0:st -> ID (a & st) (as_pure_wp (fun p -> wp s0 (curry p)))
unfold
let return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =
fun s0 p -> p x s0
let return (a:Type) (x:a) (st:Type0) : repr a st (return_wp x) =
fun s0 -> (x, s0)
unfold
let bind_wp (#a:Type) (#b:Type) (#st:Type0)
(w1 : wp st a) (w2 : a -> wp st b) : wp st b =
fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)
let bind (a:Type) (b:Type) (st:Type0)
(wp_c : wp st a)
(wp_f : a -> wp st b)
(c : repr a st wp_c)
(f : (x:a -> repr b st (wp_f x)))
: repr b st (bind_wp wp_c wp_f)
= fun s0 ->
//let (y, s1) = c s0 in
//f y s1
// GM: argh! using the match above introduces noise in the VC, a true precondition
// that becomes a pain since we don't have monotonicity nor even extensionality
let r = c s0 in
f (fst r) (snd r)
let ite_wp #a #st (b:bool) (w1 w2 : wp st a) : wp st a =
fun s0 p -> (b ==> w1 s0 p) /\ ((~b) ==> w2 s0 p)
let if_then_else
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(f : repr a st wpf)
(g : repr a st wpg)
(b : bool)
: Type
= repr a st (ite_wp b wpf wpg)
let stronger
(#a:Type) (#st:Type0)
(w1 w2 : wp st a)
: Type0
= forall s0 p. w1 s0 p ==> w2 s0 p
let subcomp
(a:Type)
(st:Type0)
(wpf wpg : wp st a)
(#[@@@ refine] u : squash (stronger wpg wpf))
(f : repr a st wpf)
: repr a st wpg
= f
total
reifiable
reflectable
effect {
ST (a:Type) ([@@@ effect_param] st:Type0) (_:wp st a)
with {repr; return; bind; subcomp; if_then_else}
}
let lift_id_st_wp #a #st (w : ID5.wp a) : wp st a =
elim_pure_wp_monotonicity_forall ();
fun s0 p -> w (fun x -> p x s0)
let lift_id_st a wp st (f : ID5.repr a wp)
: repr a st (lift_id_st_wp wp)
= fun s0 -> ID5.ID?.reflect (ID5.bind _ _ _ _ f (fun x -> ID5.return _ (x, s0)))
sub_effect ID ~> ST = lift_id_st
let null #st #a : wp st a =
fun s0 p -> forall x s1. p x s1
let get #st () : ST st st (fun s0 p -> p s0 s0) =
ST?.reflect (fun s0 -> (s0, s0))
let put #st (s:st) : ST unit st (fun _ p -> p () s) =
ST?.reflect (fun _ -> ((), s))
// this now works!!!
let test () : ST int int null =
let x = get () in
put (x + x);
get () + get ()
let addx (x:int) : ST unit int (fun s0 p -> p () (s0+x)) =
let y = get () in
put (x+y) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"ID5.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Pure.fst.checked",
"FStar.IO.fst.checked",
"FStar.Ghost.fsti.checked",
"DM4F_Utils.fst.checked"
],
"interface_file": false,
"source_file": "DM4F_layered5.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "DM4F_Utils",
"short_module": null
},
{
"abbrev": false,
"full_module": "ID5",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: Prims.int -> y: Prims.int -> DM4F_layered5.ST Prims.int | DM4F_layered5.ST | [] | [] | [
"Prims.int",
"Prims.unit",
"DM4F_layered5.put",
"DM4F_layered5.get",
"DM4F_layered5.addx",
"Prims.op_Addition"
] | [] | false | true | false | false | false | let add_via_state (x y: int) : ST int int (fun s0 p -> p (x + y) s0) =
| let o = get () in
put x;
addx y;
let r = get () in
put o;
r | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Xor64 | val eval_Xor64 (dst src: nat64) : option (nat64 & (bool & bool)) | val eval_Xor64 (dst src: nat64) : option (nat64 & (bool & bool)) | let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false)) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 54,
"end_line": 70,
"start_col": 0,
"start_line": 69
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Machine_s.nat64 -> src: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option (Vale.X64.Machine_s.nat64 * (Prims.bool * Prims.bool)) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.tuple2",
"Prims.bool",
"FStar.Pervasives.Native.Mktuple2",
"Vale.Def.Types_s.ixor",
"Vale.Def.Words_s.pow2_64",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Xor64 (dst src: nat64) : option (nat64 & (bool & bool)) =
| Some (Vale.Def.Types_s.ixor dst src, (false, false)) | false |
Vale.Inline.X64.Fadd_inline.fst | Vale.Inline.X64.Fadd_inline.fsub_lemma' | val fsub_lemma' (code: V.va_code) (_win: bool) (out f1 f2: b64) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires fsub_pre code out f1 f2 va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions va_s0 va_s1 fsub_regs_modified fsub_xmms_modified /\
fsub_post code out f1 f2 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\
ME.buffer_writeable (as_vale_buffer out) /\ ME.buffer_writeable (as_vale_buffer f1) /\
ME.buffer_writeable (as_vale_buffer f2) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)
(VS.vs_get_vale_heap va_s0)
(VS.vs_get_vale_heap va_s1))) | val fsub_lemma' (code: V.va_code) (_win: bool) (out f1 f2: b64) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires fsub_pre code out f1 f2 va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions va_s0 va_s1 fsub_regs_modified fsub_xmms_modified /\
fsub_post code out f1 f2 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\
ME.buffer_writeable (as_vale_buffer out) /\ ME.buffer_writeable (as_vale_buffer f1) /\
ME.buffer_writeable (as_vale_buffer f2) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)
(VS.vs_get_vale_heap va_s0)
(VS.vs_get_vale_heap va_s1))) | let fsub_lemma'
(code:V.va_code)
(_win:bool)
(out:b64)
(f1:b64)
(f2:b64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
fsub_pre code out f1 f2 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions va_s0 va_s1 fsub_regs_modified fsub_xmms_modified /\
fsub_post code out f1 f2 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\
ME.buffer_writeable (as_vale_buffer out) /\
ME.buffer_writeable (as_vale_buffer f1) /\
ME.buffer_writeable (as_vale_buffer f2) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
)) =
let va_s1, f = FH.va_lemma_Fsub code va_s0 (as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;
(va_s1, f) | {
"file_name": "vale/code/arch/x64/interop/Vale.Inline.X64.Fadd_inline.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 13,
"end_line": 366,
"start_col": 0,
"start_line": 339
} | module Vale.Inline.X64.Fadd_inline
open FStar.Mul
open FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module PR = Vale.X64.Print_Inline_s
module FU = Vale.Curve25519.X64.FastUtil
module FH = Vale.Curve25519.X64.FastHybrid
module FW = Vale.Curve25519.X64.FastWide
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__]
let b64 = buf_t TUInt64 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt64 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt64 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let tuint64 = TD_Base TUInt64
[@__reduce__]
let dom: IX64.arity_ok 3 td =
let y = [t64_mod; t64_no_mod; tuint64] in
assert_norm (List.length y = 3);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let add1_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(out:b64)
(f1:b64)
(f2:uint64)
(va_s0:V.va_state) ->
FU.va_req_Fast_add1 c va_s0
(as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2)
[@__reduce__]
let add1_post : VSig.vale_post dom =
fun (c:V.va_code)
(out:b64)
(f1:b64)
(f2:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
FU.va_ens_Fast_add1 c va_s0 (as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2) va_s1 f
#set-options "--z3rlimit 50"
let add1_regs_modified: MS.reg_64 -> bool = fun (r:MS.reg_64) ->
let open MS in
if r = rRax || r = rRdx || r = rR8 || r = rR9 || r = rR10 || r = rR11 then true
else false
let add1_xmms_modified = fun _ -> false
[@__reduce__]
let add1_lemma'
(code:V.va_code)
(_win:bool)
(out:b64)
(f1:b64)
(f2:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
add1_pre code out f1 f2 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions va_s0 va_s1 add1_regs_modified add1_xmms_modified /\
add1_post code out f1 f2 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\
ME.buffer_writeable (as_vale_buffer out) /\
ME.buffer_writeable (as_vale_buffer f1) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
)) =
let va_s1, f = FU.va_lemma_Fast_add1 code va_s0 (as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;
(va_s1, f)
(* Prove that add1_lemma' has the required type *)
let add1_lemma = as_t #(VSig.vale_sig add1_regs_modified add1_xmms_modified add1_pre add1_post) add1_lemma'
let code_add1 = FU.va_code_Fast_add1 ()
let of_reg (r:MS.reg_64) : option (IX64.reg_nat 3) = match r with
| 5 -> Some 0 // rdi
| 4 -> Some 1 // rsi
| 3 -> Some 2 // rdx
| _ -> None
let of_arg (i:IX64.reg_nat 3) : MS.reg_64 = match i with
| 0 -> MS.rRdi
| 1 -> MS.rRsi
| 2 -> MS.rRdx
let arg_reg : IX64.arg_reg_relation 3 = IX64.Rel of_reg of_arg
(* Here's the type expected for the add1 wrapper *)
[@__reduce__]
let lowstar_add1_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 3);
IX64.as_lowstar_sig_t_weak
3
arg_reg
add1_regs_modified
add1_xmms_modified
code_add1
dom
[]
_
_
// The boolean here doesn't matter
(W.mk_prediction code_add1 dom [] (add1_lemma code_add1 IA.win))
(* And here's the add1 wrapper itself *)
let lowstar_add1 : lowstar_add1_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 3);
IX64.wrap_weak
3
arg_reg
add1_regs_modified
add1_xmms_modified
code_add1
dom
(W.mk_prediction code_add1 dom [] (add1_lemma code_add1 IA.win))
let lowstar_add1_normal_t : normal lowstar_add1_t
= as_normal_t #lowstar_add1_t lowstar_add1
open Vale.AsLowStar.MemoryHelpers
let add_scalar out f1 f2
= DV.length_eq (get_downview out);
DV.length_eq (get_downview f1);
let (x, _) = lowstar_add1_normal_t out f1 f2 () in
x
let add1_comments : list string =
["Computes the addition of four-element f1 with value in f2"; "and returns the carry (if any)"]
let add1_names (n:nat) =
match n with
| 0 -> "out"
| 1 -> "f1"
| 2 -> "f2"
| _ -> ""
let add1_code_inline () : FStar.All.ML int =
PR.print_inline "add_scalar" 0 None (List.length dom) dom add1_names code_add1 of_arg add1_regs_modified add1_comments
[@__reduce__]
let fadd_dom: IX64.arity_ok_stdcall td =
let y = [t64_mod; t64_no_mod; t64_no_mod] in
assert_norm (List.length y = 3);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let fadd_pre : VSig.vale_pre fadd_dom =
fun (c:V.va_code)
(out:b64)
(f1:b64)
(f2:b64)
(va_s0:V.va_state) ->
FH.va_req_Fadd c va_s0
(as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2)
[@__reduce__]
let fadd_post : VSig.vale_post fadd_dom =
fun (c:V.va_code)
(out:b64)
(f1:b64)
(f2:b64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
FH.va_ens_Fadd c va_s0 (as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2) va_s1 f
#set-options "--z3rlimit 50"
let fadd_regs_modified: MS.reg_64 -> bool = fun (r:MS.reg_64) ->
let open MS in
if r = rRax || r = rRcx || r = rRdx || r = rR8 || r = rR9 || r = rR10 || r = rR11 then true
else false
let fadd_xmms_modified = fun _ -> false
[@__reduce__]
let fadd_lemma'
(code:V.va_code)
(_win:bool)
(out:b64)
(f1:b64)
(f2:b64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
fadd_pre code out f1 f2 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions va_s0 va_s1 fadd_regs_modified fadd_xmms_modified /\
fadd_post code out f1 f2 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\
ME.buffer_writeable (as_vale_buffer out) /\
ME.buffer_writeable (as_vale_buffer f1) /\
ME.buffer_writeable (as_vale_buffer f2) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
)) =
let va_s1, f = FH.va_lemma_Fadd code va_s0 (as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;
(va_s1, f)
(* Prove that add1_lemma' has the required type *)
let fadd_lemma = as_t #(VSig.vale_sig fadd_regs_modified fadd_xmms_modified fadd_pre fadd_post) fadd_lemma'
let code_Fadd = FH.va_code_Fadd ()
(* Here's the type expected for the fadd wrapper *)
[@__reduce__]
let lowstar_fadd_t =
assert_norm (List.length fadd_dom + List.length ([]<:list arg) <= 3);
IX64.as_lowstar_sig_t_weak
3
arg_reg
fadd_regs_modified
fadd_xmms_modified
code_Fadd
fadd_dom
[]
_
_
// The boolean here doesn't matter
(W.mk_prediction code_Fadd fadd_dom [] (fadd_lemma code_Fadd IA.win))
(* And here's the fadd wrapper itself *)
let lowstar_fadd : lowstar_fadd_t =
assert_norm (List.length fadd_dom + List.length ([]<:list arg) <= 3);
IX64.wrap_weak
3
arg_reg
fadd_regs_modified
fadd_xmms_modified
code_Fadd
fadd_dom
(W.mk_prediction code_Fadd fadd_dom [] (fadd_lemma code_Fadd IA.win))
let lowstar_fadd_normal_t : normal lowstar_fadd_t
= as_normal_t #lowstar_fadd_t lowstar_fadd
let fadd out f1 f2
= DV.length_eq (get_downview out);
DV.length_eq (get_downview f1);
DV.length_eq (get_downview f2);
let (x, _) = lowstar_fadd_normal_t out f1 f2 () in
()
let fadd_comments : list string = ["Computes the field addition of two field elements"]
let fadd_names (n:nat) =
match n with
| 0 -> "out"
| 1 -> "f1"
| 2 -> "f2"
| _ -> ""
let fadd_code_inline () : FStar.All.ML int =
PR.print_inline "fadd" 0 None (List.length fadd_dom) fadd_dom fadd_names code_Fadd of_arg fadd_regs_modified fadd_comments
[@__reduce__]
let fsub_dom: IX64.arity_ok_stdcall td =
let y = [t64_mod; t64_no_mod; t64_no_mod] in
assert_norm (List.length y = 3);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let fsub_pre : VSig.vale_pre fsub_dom =
fun (c:V.va_code)
(out:b64)
(f1:b64)
(f2:b64)
(va_s0:V.va_state) ->
FH.va_req_Fsub c va_s0
(as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2)
[@__reduce__]
let fsub_post : VSig.vale_post fsub_dom =
fun (c:V.va_code)
(out:b64)
(f1:b64)
(f2:b64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
FH.va_ens_Fsub c va_s0 (as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2) va_s1 f
#set-options "--z3rlimit 200"
let fsub_regs_modified: MS.reg_64 -> bool = fun (r:MS.reg_64) ->
let open MS in
if r = rRax || r = rRcx || r = rR8 || r = rR9 || r = rR10 || r = rR11 then true
else false
let fsub_xmms_modified = fun _ -> false | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Curve25519.X64.FastWide.fsti.checked",
"Vale.Curve25519.X64.FastUtil.fsti.checked",
"Vale.Curve25519.X64.FastHybrid.fsti.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Inline.X64.Fadd_inline.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AsLowStar.MemoryHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Curve25519.X64.FastWide",
"short_module": "FW"
},
{
"abbrev": true,
"full_module": "Vale.Curve25519.X64.FastHybrid",
"short_module": "FH"
},
{
"abbrev": true,
"full_module": "Vale.Curve25519.X64.FastUtil",
"short_module": "FU"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": "PR"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
code: Vale.X64.Decls.va_code ->
_win: Prims.bool ->
out: Vale.Inline.X64.Fadd_inline.b64 ->
f1: Vale.Inline.X64.Fadd_inline.b64 ->
f2: Vale.Inline.X64.Fadd_inline.b64 ->
va_s0: Vale.X64.Decls.va_state
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Decls.va_code",
"Prims.bool",
"Vale.Inline.X64.Fadd_inline.b64",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple2",
"Prims.unit",
"Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal",
"Vale.Arch.HeapTypes_s.TUInt64",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.Curve25519.X64.FastHybrid.va_lemma_Fsub",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Inline.X64.Fadd_inline.fsub_pre",
"Prims.l_and",
"Vale.X64.Decls.eval_code",
"Vale.AsLowStar.ValeSig.vale_calling_conventions",
"Vale.Inline.X64.Fadd_inline.fsub_regs_modified",
"Vale.Inline.X64.Fadd_inline.fsub_xmms_modified",
"Vale.X64.Machine_s.reg_xmm",
"Vale.Inline.X64.Fadd_inline.fsub_post",
"Vale.X64.Memory.buffer_readable",
"Vale.X64.State.vs_get_vale_heap",
"Vale.X64.Memory.buffer_writeable",
"Vale.X64.Memory.modifies",
"Vale.X64.Memory.loc_union",
"Vale.X64.Memory.loc_buffer",
"Vale.X64.Memory.loc_none"
] | [] | false | false | false | false | false | let fsub_lemma' (code: V.va_code) (_win: bool) (out f1 f2: b64) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires fsub_pre code out f1 f2 va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions va_s0 va_s1 fsub_regs_modified fsub_xmms_modified /\
fsub_post code out f1 f2 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\
ME.buffer_writeable (as_vale_buffer out) /\ ME.buffer_writeable (as_vale_buffer f1) /\
ME.buffer_writeable (as_vale_buffer f2) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)
(VS.vs_get_vale_heap va_s0)
(VS.vs_get_vale_heap va_s1))) =
| let va_s1, f =
FH.va_lemma_Fsub code va_s0 (as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2)
in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;
(va_s1, f) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Shr64 | val eval_Shr64 (dst amt: nat64) : option nat64 | val eval_Shr64 (dst amt: nat64) : option nat64 | let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 65,
"end_line": 74,
"start_col": 0,
"start_line": 73
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Machine_s.nat64 -> amt: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.nat64 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"Prims.op_LessThan",
"FStar.Pervasives.Native.Some",
"Vale.Def.Types_s.ishr",
"Vale.Def.Words_s.pow2_64",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Shr64 (dst amt: nat64) : option nat64 =
| if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_And64 | val eval_And64 (dst src: nat64) : option nat64 | val eval_And64 (dst src: nat64) : option nat64 | let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 67,
"end_line": 66,
"start_col": 0,
"start_line": 66
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Machine_s.nat64 -> src: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.nat64 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"FStar.Pervasives.Native.Some",
"Vale.Def.Types_s.iand",
"Vale.Def.Words_s.pow2_64",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_And64 (dst src: nat64) : option nat64 =
| Some (iand dst src) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.check_avx | val check_avx (#a: Type0) (x: option a) : option a | val check_avx (#a: Type0) (x: option a) : option a | let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 99,
"start_col": 0,
"start_line": 98
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.Pervasives.Native.option a -> FStar.Pervasives.Native.option a | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.option",
"Vale.X64.CPU_Features_s.avx_enabled",
"Prims.bool",
"FStar.Pervasives.Native.None"
] | [] | false | false | false | true | false | let check_avx (#a: Type0) (x: option a) : option a =
| if avx_enabled then x else None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.check_sse2 | val check_sse2 (#a: Type0) (x: option a) : option a | val check_sse2 (#a: Type0) (x: option a) : option a | let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 102,
"start_col": 0,
"start_line": 101
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.Pervasives.Native.option a -> FStar.Pervasives.Native.option a | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.option",
"Vale.X64.CPU_Features_s.sse2_enabled",
"Prims.bool",
"FStar.Pervasives.Native.None"
] | [] | false | false | false | true | false | let check_sse2 (#a: Type0) (x: option a) : option a =
| if sse2_enabled then x else None | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.comp_typing_from_post_hint | val comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c) | val comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c) | let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 33,
"end_line": 158,
"start_col": 0,
"start_line": 145
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Pulse.Syntax.Base.comp_st ->
pre_typing: Pulse.Typing.tot_typing g (Pulse.Syntax.Base.comp_pre c) Pulse.Syntax.Base.tm_vprop ->
p:
Pulse.Typing.post_hint_for_env g
{Pulse.Typing.comp_post_matches_hint c (FStar.Pervasives.Native.Some p)}
-> FStar.Tactics.Effect.Tac (Pulse.Typing.comp_typing_u g c) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.comp_st",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.comp_pre",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Typing.post_hint_for_env",
"Pulse.Typing.comp_post_matches_hint",
"FStar.Pervasives.Native.Some",
"Pulse.Typing.post_hint_t",
"FStar.Set.mem",
"Pulse.Syntax.Base.var",
"Pulse.Syntax.Naming.freevars",
"Pulse.Typing.__proj__Mkpost_hint_t__item__post",
"Pulse.Typing.Env.fail",
"Pulse.Typing.comp_typing_u",
"FStar.Pervasives.Native.None",
"Pulse.Syntax.Base.range",
"Prims.bool",
"Pulse.Checker.Base.intro_comp_typing",
"Pulse.Typing.__proj__Mkpost_hint_typing_t__item__effect_annot_typing",
"Pulse.Typing.__proj__Mkpost_hint_typing_t__item__ty_typing",
"Pulse.Typing.__proj__Mkpost_hint_typing_t__item__post_typing",
"Pulse.Typing.comp_typing",
"Pulse.Syntax.Base.universe_of_comp",
"Pulse.Typing.post_hint_typing_t",
"Pulse.Typing.post_hint_typing",
"Prims.l_not",
"Prims.b2t",
"Pulse.Typing.Env.dom",
"Pulse.Typing.Env.fresh"
] | [] | false | true | false | false | false | let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p: post_hint_for_env g {comp_post_matches_hint c (Some p)})
: T.Tac (comp_typing_u g c) =
| let x = fresh g in
if x `Set.mem` (freevars p.post)
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else
let post_typing = post_hint_typing g p x in
intro_comp_typing g
c
pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x
post_typing.post_typing | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Xgetbv | val eval_Xgetbv (rcx: nat64) : option (nat64 & nat64) | val eval_Xgetbv (rcx: nat64) : option (nat64 & nat64) | let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 86,
"end_line": 92,
"start_col": 0,
"start_line": 91
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | rcx: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option (Vale.X64.Machine_s.nat64 * Vale.X64.Machine_s.nat64) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"Prims.op_AmpAmp",
"Vale.X64.CPU_Features_s.osxsave_enabled",
"Prims.op_Equality",
"Prims.int",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2",
"Vale.X64.CPU_Features_s.xgetbv",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Machine_s.rRdx",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Xgetbv (rcx: nat64) : option (nat64 & nat64) =
| if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Shl64 | val eval_Shl64 (dst amt: nat64) : option nat64 | val eval_Shl64 (dst amt: nat64) : option nat64 | let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 65,
"end_line": 78,
"start_col": 0,
"start_line": 77
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Machine_s.nat64 -> amt: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.nat64 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"Prims.op_LessThan",
"FStar.Pervasives.Native.Some",
"Vale.Def.Types_s.ishl",
"Vale.Def.Words_s.pow2_64",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Shl64 (dst amt: nat64) : option nat64 =
| if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.check_sse4_1 | val check_sse4_1 (#a: Type0) (x: option a) : option a | val check_sse4_1 (#a: Type0) (x: option a) : option a | let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 36,
"end_line": 108,
"start_col": 0,
"start_line": 107
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.Pervasives.Native.option a -> FStar.Pervasives.Native.option a | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.option",
"Vale.X64.CPU_Features_s.sse4_1_enabled",
"Prims.bool",
"FStar.Pervasives.Native.None"
] | [] | false | false | false | true | false | let check_sse4_1 (#a: Type0) (x: option a) : option a =
| if sse4_1_enabled then x else None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Cpuid | val eval_Cpuid (rax rcx: nat64) : option (nat64 & (nat64 & (nat64 & nat64))) | val eval_Cpuid (rax rcx: nat64) : option (nat64 & (nat64 & (nat64 & nat64))) | let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 91,
"end_line": 82,
"start_col": 0,
"start_line": 81
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | rax: Vale.X64.Machine_s.nat64 -> rcx: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option (Vale.X64.Machine_s.nat64 *
(Vale.X64.Machine_s.nat64 * (Vale.X64.Machine_s.nat64 * Vale.X64.Machine_s.nat64))) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2",
"Vale.X64.CPU_Features_s.cpuid",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRdx",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Cpuid (rax rcx: nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
| Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.intro_comp_typing | val intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(iname_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c)) | val intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(iname_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c)) | let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 24,
"end_line": 80,
"start_col": 0,
"start_line": 56
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
g: Pulse.Typing.Env.env ->
c: Pulse.Syntax.Base.comp_st ->
pre_typing: Pulse.Typing.tot_typing g (Pulse.Syntax.Base.comp_pre c) Pulse.Syntax.Base.tm_vprop ->
iname_typing: Pulse.Typing.effect_annot_typing g (Pulse.Syntax.Base.effect_annot_of_comp c) ->
res_typing:
Pulse.Typing.universe_of g (Pulse.Syntax.Base.comp_res c) (Pulse.Syntax.Base.comp_u c) ->
x:
Pulse.Syntax.Base.var
{Pulse.Typing.fresh_wrt x g (Pulse.Syntax.Naming.freevars (Pulse.Syntax.Base.comp_post c))} ->
post_typing:
Pulse.Typing.tot_typing (Pulse.Typing.Env.push_binding g
x
Pulse.Syntax.Base.ppname_default
(Pulse.Syntax.Base.comp_res c))
(Pulse.Syntax.Naming.open_term (Pulse.Syntax.Base.comp_post c) x)
Pulse.Syntax.Base.tm_vprop
-> FStar.Tactics.Effect.Tac (Pulse.Typing.comp_typing g c (Pulse.Syntax.Base.universe_of_comp c)) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.comp_st",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.comp_pre",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Typing.effect_annot_typing",
"Pulse.Syntax.Base.effect_annot_of_comp",
"Pulse.Typing.universe_of",
"Pulse.Syntax.Base.comp_res",
"Pulse.Syntax.Base.comp_u",
"Pulse.Syntax.Base.var",
"Pulse.Typing.fresh_wrt",
"Pulse.Syntax.Naming.freevars",
"Pulse.Syntax.Base.comp_post",
"Pulse.Typing.Env.push_binding",
"Pulse.Syntax.Base.ppname_default",
"Pulse.Syntax.Naming.open_term",
"Pulse.Syntax.Base.st_comp",
"Pulse.Typing.CT_ST",
"Pulse.Typing.comp_typing",
"Pulse.Syntax.Base.universe_of_comp",
"Pulse.Typing.st_comp_typing",
"Pulse.Syntax.Base.term",
"Pulse.Syntax.Base.observability",
"Pulse.Typing.CT_STAtomic",
"Pulse.Typing.CT_STGhost",
"Prims.l_and",
"Prims.eq2",
"Pulse.Syntax.Base.universe",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__u",
"Pulse.Syntax.Base.vprop",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__pre",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__res",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__post",
"Pulse.Typing.STC"
] | [] | false | true | false | false | false | let intro_comp_typing
(g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(i_typing: effect_annot_typing g (effect_annot_of_comp c))
(res_typing: universe_of g (comp_res c) (comp_u c))
(x: var{fresh_wrt x g (freevars (comp_post c))})
(post_typing:
tot_typing (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c)) =
| let intro_st_comp_typing
(st:
st_comp
{ comp_u c == st.u /\ comp_pre c == st.pre /\ comp_res c == st.res /\
comp_post c == st.post })
: T.Tac (st_comp_typing g st) =
STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.check_ssse3 | val check_ssse3 (#a: Type0) (x: option a) : option a | val check_ssse3 (#a: Type0) (x: option a) : option a | let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 35,
"end_line": 105,
"start_col": 0,
"start_line": 104
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.Pervasives.Native.option a -> FStar.Pervasives.Native.option a | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.option",
"Vale.X64.CPU_Features_s.ssse3_enabled",
"Prims.bool",
"FStar.Pervasives.Native.None"
] | [] | false | false | false | true | false | let check_ssse3 (#a: Type0) (x: option a) : option a =
| if ssse3_enabled then x else None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Pand | val eval_Pand (dst src: quad32) : option quad32 | val eval_Pand (dst src: quad32) : option quad32 | let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 112,
"end_line": 119,
"start_col": 0,
"start_line": 119
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Machine_s.quad32 -> src: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_sse2",
"FStar.Pervasives.Native.Some",
"Vale.Def.Words.Four_s.four_map2",
"Vale.Def.Words_s.natN",
"Vale.Def.Words_s.pow2_32",
"Vale.Def.Types_s.iand",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Pand (dst src: quad32) : option quad32 =
| check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Add64 | val eval_Add64 (dst src: nat64) : option (bool & nat64) | val eval_Add64 (dst src: nat64) : option (bool & nat64) | let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 61,
"end_line": 26,
"start_col": 0,
"start_line": 25
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Machine_s.nat64 -> src: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option (Prims.bool * Vale.X64.Machine_s.nat64) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.tuple2",
"Prims.bool",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_GreaterThanOrEqual",
"Vale.X64.Machine_s.pow2_64",
"Prims.op_Modulus",
"Prims.int",
"Prims.op_Addition",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Add64 (dst src: nat64) : option (bool & nat64) =
| let sum = dst + src in
Some (sum >= pow2_64, sum % pow2_64) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Movdqu | val eval_Movdqu (src: quad32) : option quad32 | val eval_Movdqu (src: quad32) : option quad32 | let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 68,
"end_line": 110,
"start_col": 0,
"start_line": 110
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | src: Vale.X64.Machine_s.quad32 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_sse2",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Movdqu (src: quad32) : option quad32 =
| check_sse2 (Some src) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_VPxor | val eval_VPxor (src1 src2: quad32) : option quad32 | val eval_VPxor (src1 src2: quad32) : option quad32 | let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 91,
"end_line": 116,
"start_col": 0,
"start_line": 116
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_avx",
"FStar.Pervasives.Native.Some",
"Vale.Def.Types_s.quad32_xor",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_VPxor (src1 src2: quad32) : option quad32 =
| check_avx (Some (quad32_xor src1 src2)) | false |
Vale.Inline.X64.Fadd_inline.fst | Vale.Inline.X64.Fadd_inline.add_scalar | val add_scalar
(out:u256)
(f1:u256)
(f2:UInt64.t)
: Stack (Ghost.erased UInt64.t)
(requires fun h ->
adx_enabled /\ bmi2_enabled /\
B.live h out /\ B.live h f1 /\
(B.disjoint out f1 \/ out == f1))
(ensures fun h0 c h1 ->
B.live h1 out /\ B.live h1 f1 /\
B.modifies (B.loc_buffer out) h0 h1 /\
as_nat out h1 + pow2_256 * UInt64.v c == as_nat f1 h0 + UInt64.v f2) | val add_scalar
(out:u256)
(f1:u256)
(f2:UInt64.t)
: Stack (Ghost.erased UInt64.t)
(requires fun h ->
adx_enabled /\ bmi2_enabled /\
B.live h out /\ B.live h f1 /\
(B.disjoint out f1 \/ out == f1))
(ensures fun h0 c h1 ->
B.live h1 out /\ B.live h1 f1 /\
B.modifies (B.loc_buffer out) h0 h1 /\
as_nat out h1 + pow2_256 * UInt64.v c == as_nat f1 h0 + UInt64.v f2) | let add_scalar out f1 f2
= DV.length_eq (get_downview out);
DV.length_eq (get_downview f1);
let (x, _) = lowstar_add1_normal_t out f1 f2 () in
x | {
"file_name": "vale/code/arch/x64/interop/Vale.Inline.X64.Fadd_inline.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 5,
"end_line": 162,
"start_col": 0,
"start_line": 158
} | module Vale.Inline.X64.Fadd_inline
open FStar.Mul
open FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module PR = Vale.X64.Print_Inline_s
module FU = Vale.Curve25519.X64.FastUtil
module FH = Vale.Curve25519.X64.FastHybrid
module FW = Vale.Curve25519.X64.FastWide
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__]
let b64 = buf_t TUInt64 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt64 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt64 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let tuint64 = TD_Base TUInt64
[@__reduce__]
let dom: IX64.arity_ok 3 td =
let y = [t64_mod; t64_no_mod; tuint64] in
assert_norm (List.length y = 3);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let add1_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(out:b64)
(f1:b64)
(f2:uint64)
(va_s0:V.va_state) ->
FU.va_req_Fast_add1 c va_s0
(as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2)
[@__reduce__]
let add1_post : VSig.vale_post dom =
fun (c:V.va_code)
(out:b64)
(f1:b64)
(f2:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
FU.va_ens_Fast_add1 c va_s0 (as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2) va_s1 f
#set-options "--z3rlimit 50"
let add1_regs_modified: MS.reg_64 -> bool = fun (r:MS.reg_64) ->
let open MS in
if r = rRax || r = rRdx || r = rR8 || r = rR9 || r = rR10 || r = rR11 then true
else false
let add1_xmms_modified = fun _ -> false
[@__reduce__]
let add1_lemma'
(code:V.va_code)
(_win:bool)
(out:b64)
(f1:b64)
(f2:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
add1_pre code out f1 f2 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions va_s0 va_s1 add1_regs_modified add1_xmms_modified /\
add1_post code out f1 f2 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\
ME.buffer_writeable (as_vale_buffer out) /\
ME.buffer_writeable (as_vale_buffer f1) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
)) =
let va_s1, f = FU.va_lemma_Fast_add1 code va_s0 (as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;
(va_s1, f)
(* Prove that add1_lemma' has the required type *)
let add1_lemma = as_t #(VSig.vale_sig add1_regs_modified add1_xmms_modified add1_pre add1_post) add1_lemma'
let code_add1 = FU.va_code_Fast_add1 ()
let of_reg (r:MS.reg_64) : option (IX64.reg_nat 3) = match r with
| 5 -> Some 0 // rdi
| 4 -> Some 1 // rsi
| 3 -> Some 2 // rdx
| _ -> None
let of_arg (i:IX64.reg_nat 3) : MS.reg_64 = match i with
| 0 -> MS.rRdi
| 1 -> MS.rRsi
| 2 -> MS.rRdx
let arg_reg : IX64.arg_reg_relation 3 = IX64.Rel of_reg of_arg
(* Here's the type expected for the add1 wrapper *)
[@__reduce__]
let lowstar_add1_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 3);
IX64.as_lowstar_sig_t_weak
3
arg_reg
add1_regs_modified
add1_xmms_modified
code_add1
dom
[]
_
_
// The boolean here doesn't matter
(W.mk_prediction code_add1 dom [] (add1_lemma code_add1 IA.win))
(* And here's the add1 wrapper itself *)
let lowstar_add1 : lowstar_add1_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 3);
IX64.wrap_weak
3
arg_reg
add1_regs_modified
add1_xmms_modified
code_add1
dom
(W.mk_prediction code_add1 dom [] (add1_lemma code_add1 IA.win))
let lowstar_add1_normal_t : normal lowstar_add1_t
= as_normal_t #lowstar_add1_t lowstar_add1
open Vale.AsLowStar.MemoryHelpers | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Curve25519.X64.FastWide.fsti.checked",
"Vale.Curve25519.X64.FastUtil.fsti.checked",
"Vale.Curve25519.X64.FastHybrid.fsti.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Inline.X64.Fadd_inline.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AsLowStar.MemoryHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Curve25519.X64.FastWide",
"short_module": "FW"
},
{
"abbrev": true,
"full_module": "Vale.Curve25519.X64.FastHybrid",
"short_module": "FH"
},
{
"abbrev": true,
"full_module": "Vale.Curve25519.X64.FastUtil",
"short_module": "FU"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": "PR"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | out: Vale.Inline.X64.Fadd_inline.u256 -> f1: Vale.Inline.X64.Fadd_inline.u256 -> f2: FStar.UInt64.t
-> FStar.HyperStack.ST.Stack (FStar.Ghost.erased FStar.UInt64.t) | FStar.HyperStack.ST.Stack | [] | [] | [
"Vale.Inline.X64.Fadd_inline.u256",
"FStar.UInt64.t",
"FStar.Ghost.erased",
"Vale.Interop.X64.as_lowstar_sig_ret",
"FStar.Ghost.hide",
"Vale.Interop.X64.als_ret",
"Vale.Inline.X64.Fadd_inline.lowstar_add1_normal_t",
"Prims.unit",
"LowStar.BufferView.Down.length_eq",
"FStar.UInt8.t",
"Vale.Interop.Types.get_downview",
"Vale.Arch.HeapTypes_s.TUInt64",
"LowStar.Buffer.trivial_preorder"
] | [] | false | true | false | false | false | let add_scalar out f1 f2 =
| DV.length_eq (get_downview out);
DV.length_eq (get_downview f1);
let x, _ = lowstar_add1_normal_t out f1 f2 () in
x | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Pxor | val eval_Pxor (dst src: quad32) : option quad32 | val eval_Pxor (dst src: quad32) : option quad32 | let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 87,
"end_line": 113,
"start_col": 0,
"start_line": 113
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Machine_s.quad32 -> src: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_sse2",
"FStar.Pervasives.Native.Some",
"Vale.Def.Types_s.quad32_xor",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Pxor (dst src: quad32) : option quad32 =
| check_sse2 (Some (quad32_xor dst src)) | false |
Vale.Inline.X64.Fadd_inline.fst | Vale.Inline.X64.Fadd_inline.fadd_lemma' | val fadd_lemma' (code: V.va_code) (_win: bool) (out f1 f2: b64) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires fadd_pre code out f1 f2 va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions va_s0 va_s1 fadd_regs_modified fadd_xmms_modified /\
fadd_post code out f1 f2 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\
ME.buffer_writeable (as_vale_buffer out) /\ ME.buffer_writeable (as_vale_buffer f1) /\
ME.buffer_writeable (as_vale_buffer f2) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)
(VS.vs_get_vale_heap va_s0)
(VS.vs_get_vale_heap va_s1))) | val fadd_lemma' (code: V.va_code) (_win: bool) (out f1 f2: b64) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires fadd_pre code out f1 f2 va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions va_s0 va_s1 fadd_regs_modified fadd_xmms_modified /\
fadd_post code out f1 f2 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\
ME.buffer_writeable (as_vale_buffer out) /\ ME.buffer_writeable (as_vale_buffer f1) /\
ME.buffer_writeable (as_vale_buffer f2) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)
(VS.vs_get_vale_heap va_s0)
(VS.vs_get_vale_heap va_s1))) | let fadd_lemma'
(code:V.va_code)
(_win:bool)
(out:b64)
(f1:b64)
(f2:b64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
fadd_pre code out f1 f2 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions va_s0 va_s1 fadd_regs_modified fadd_xmms_modified /\
fadd_post code out f1 f2 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\
ME.buffer_writeable (as_vale_buffer out) /\
ME.buffer_writeable (as_vale_buffer f1) /\
ME.buffer_writeable (as_vale_buffer f2) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
)) =
let va_s1, f = FH.va_lemma_Fadd code va_s0 (as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;
(va_s1, f) | {
"file_name": "vale/code/arch/x64/interop/Vale.Inline.X64.Fadd_inline.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 13,
"end_line": 243,
"start_col": 0,
"start_line": 216
} | module Vale.Inline.X64.Fadd_inline
open FStar.Mul
open FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module DV = LowStar.BufferView.Down
open Vale.Def.Types_s
open Vale.Interop.Base
module IX64 = Vale.Interop.X64
module VSig = Vale.AsLowStar.ValeSig
module LSig = Vale.AsLowStar.LowStarSig
module ME = Vale.X64.Memory
module V = Vale.X64.Decls
module IA = Vale.Interop.Assumptions
module W = Vale.AsLowStar.Wrapper
open Vale.X64.MemoryAdapters
module VS = Vale.X64.State
module MS = Vale.X64.Machine_s
module PR = Vale.X64.Print_Inline_s
module FU = Vale.Curve25519.X64.FastUtil
module FH = Vale.Curve25519.X64.FastHybrid
module FW = Vale.Curve25519.X64.FastWide
let uint64 = UInt64.t
(* A little utility to trigger normalization in types *)
let as_t (#a:Type) (x:normal a) : a = x
let as_normal_t (#a:Type) (x:a) : normal a = x
[@__reduce__]
let b64 = buf_t TUInt64 TUInt64
[@__reduce__]
let t64_mod = TD_Buffer TUInt64 TUInt64 default_bq
[@__reduce__]
let t64_no_mod = TD_Buffer TUInt64 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})
[@__reduce__]
let tuint64 = TD_Base TUInt64
[@__reduce__]
let dom: IX64.arity_ok 3 td =
let y = [t64_mod; t64_no_mod; tuint64] in
assert_norm (List.length y = 3);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let add1_pre : VSig.vale_pre dom =
fun (c:V.va_code)
(out:b64)
(f1:b64)
(f2:uint64)
(va_s0:V.va_state) ->
FU.va_req_Fast_add1 c va_s0
(as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2)
[@__reduce__]
let add1_post : VSig.vale_post dom =
fun (c:V.va_code)
(out:b64)
(f1:b64)
(f2:uint64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
FU.va_ens_Fast_add1 c va_s0 (as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2) va_s1 f
#set-options "--z3rlimit 50"
let add1_regs_modified: MS.reg_64 -> bool = fun (r:MS.reg_64) ->
let open MS in
if r = rRax || r = rRdx || r = rR8 || r = rR9 || r = rR10 || r = rR11 then true
else false
let add1_xmms_modified = fun _ -> false
[@__reduce__]
let add1_lemma'
(code:V.va_code)
(_win:bool)
(out:b64)
(f1:b64)
(f2:uint64)
(va_s0:V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires
add1_pre code out f1 f2 va_s0)
(ensures (fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions va_s0 va_s1 add1_regs_modified add1_xmms_modified /\
add1_post code out f1 f2 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\
ME.buffer_writeable (as_vale_buffer out) /\
ME.buffer_writeable (as_vale_buffer f1) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))
ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)
)) =
let va_s1, f = FU.va_lemma_Fast_add1 code va_s0 (as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2) in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;
(va_s1, f)
(* Prove that add1_lemma' has the required type *)
let add1_lemma = as_t #(VSig.vale_sig add1_regs_modified add1_xmms_modified add1_pre add1_post) add1_lemma'
let code_add1 = FU.va_code_Fast_add1 ()
let of_reg (r:MS.reg_64) : option (IX64.reg_nat 3) = match r with
| 5 -> Some 0 // rdi
| 4 -> Some 1 // rsi
| 3 -> Some 2 // rdx
| _ -> None
let of_arg (i:IX64.reg_nat 3) : MS.reg_64 = match i with
| 0 -> MS.rRdi
| 1 -> MS.rRsi
| 2 -> MS.rRdx
let arg_reg : IX64.arg_reg_relation 3 = IX64.Rel of_reg of_arg
(* Here's the type expected for the add1 wrapper *)
[@__reduce__]
let lowstar_add1_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 3);
IX64.as_lowstar_sig_t_weak
3
arg_reg
add1_regs_modified
add1_xmms_modified
code_add1
dom
[]
_
_
// The boolean here doesn't matter
(W.mk_prediction code_add1 dom [] (add1_lemma code_add1 IA.win))
(* And here's the add1 wrapper itself *)
let lowstar_add1 : lowstar_add1_t =
assert_norm (List.length dom + List.length ([]<:list arg) <= 3);
IX64.wrap_weak
3
arg_reg
add1_regs_modified
add1_xmms_modified
code_add1
dom
(W.mk_prediction code_add1 dom [] (add1_lemma code_add1 IA.win))
let lowstar_add1_normal_t : normal lowstar_add1_t
= as_normal_t #lowstar_add1_t lowstar_add1
open Vale.AsLowStar.MemoryHelpers
let add_scalar out f1 f2
= DV.length_eq (get_downview out);
DV.length_eq (get_downview f1);
let (x, _) = lowstar_add1_normal_t out f1 f2 () in
x
let add1_comments : list string =
["Computes the addition of four-element f1 with value in f2"; "and returns the carry (if any)"]
let add1_names (n:nat) =
match n with
| 0 -> "out"
| 1 -> "f1"
| 2 -> "f2"
| _ -> ""
let add1_code_inline () : FStar.All.ML int =
PR.print_inline "add_scalar" 0 None (List.length dom) dom add1_names code_add1 of_arg add1_regs_modified add1_comments
[@__reduce__]
let fadd_dom: IX64.arity_ok_stdcall td =
let y = [t64_mod; t64_no_mod; t64_no_mod] in
assert_norm (List.length y = 3);
y
(* Need to rearrange the order of arguments *)
[@__reduce__]
let fadd_pre : VSig.vale_pre fadd_dom =
fun (c:V.va_code)
(out:b64)
(f1:b64)
(f2:b64)
(va_s0:V.va_state) ->
FH.va_req_Fadd c va_s0
(as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2)
[@__reduce__]
let fadd_post : VSig.vale_post fadd_dom =
fun (c:V.va_code)
(out:b64)
(f1:b64)
(f2:b64)
(va_s0:V.va_state)
(va_s1:V.va_state)
(f:V.va_fuel) ->
FH.va_ens_Fadd c va_s0 (as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2) va_s1 f
#set-options "--z3rlimit 50"
let fadd_regs_modified: MS.reg_64 -> bool = fun (r:MS.reg_64) ->
let open MS in
if r = rRax || r = rRcx || r = rRdx || r = rR8 || r = rR9 || r = rR10 || r = rR11 then true
else false
let fadd_xmms_modified = fun _ -> false | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Print_Inline_s.fst.checked",
"Vale.X64.MemoryAdapters.fsti.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.Interop.X64.fsti.checked",
"Vale.Interop.Base.fst.checked",
"Vale.Interop.Assumptions.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Curve25519.X64.FastWide.fsti.checked",
"Vale.Curve25519.X64.FastUtil.fsti.checked",
"Vale.Curve25519.X64.FastHybrid.fsti.checked",
"Vale.AsLowStar.Wrapper.fsti.checked",
"Vale.AsLowStar.ValeSig.fst.checked",
"Vale.AsLowStar.MemoryHelpers.fsti.checked",
"Vale.AsLowStar.LowStarSig.fst.checked",
"prims.fst.checked",
"LowStar.BufferView.Down.fsti.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.All.fst.checked"
],
"interface_file": true,
"source_file": "Vale.Inline.X64.Fadd_inline.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.AsLowStar.MemoryHelpers",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.Curve25519.X64.FastWide",
"short_module": "FW"
},
{
"abbrev": true,
"full_module": "Vale.Curve25519.X64.FastHybrid",
"short_module": "FH"
},
{
"abbrev": true,
"full_module": "Vale.Curve25519.X64.FastUtil",
"short_module": "FU"
},
{
"abbrev": true,
"full_module": "Vale.X64.Print_Inline_s",
"short_module": "PR"
},
{
"abbrev": true,
"full_module": "Vale.X64.Machine_s",
"short_module": "MS"
},
{
"abbrev": true,
"full_module": "Vale.X64.State",
"short_module": "VS"
},
{
"abbrev": false,
"full_module": "Vale.X64.MemoryAdapters",
"short_module": null
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.Wrapper",
"short_module": "W"
},
{
"abbrev": true,
"full_module": "Vale.Interop.Assumptions",
"short_module": "IA"
},
{
"abbrev": true,
"full_module": "Vale.X64.Decls",
"short_module": "V"
},
{
"abbrev": true,
"full_module": "Vale.X64.Memory",
"short_module": "ME"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.LowStarSig",
"short_module": "LSig"
},
{
"abbrev": true,
"full_module": "Vale.AsLowStar.ValeSig",
"short_module": "VSig"
},
{
"abbrev": true,
"full_module": "Vale.Interop.X64",
"short_module": "IX64"
},
{
"abbrev": false,
"full_module": "Vale.Interop.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.BufferView.Down",
"short_module": "DV"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Curve25519.Fast_defs",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Inline.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
code: Vale.X64.Decls.va_code ->
_win: Prims.bool ->
out: Vale.Inline.X64.Fadd_inline.b64 ->
f1: Vale.Inline.X64.Fadd_inline.b64 ->
f2: Vale.Inline.X64.Fadd_inline.b64 ->
va_s0: Vale.X64.Decls.va_state
-> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.X64.Decls.va_code",
"Prims.bool",
"Vale.Inline.X64.Fadd_inline.b64",
"Vale.X64.Decls.va_state",
"Vale.X64.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple2",
"Prims.unit",
"Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal",
"Vale.Arch.HeapTypes_s.TUInt64",
"FStar.Pervasives.Native.tuple2",
"Vale.X64.State.vale_state",
"Vale.Curve25519.X64.FastHybrid.va_lemma_Fadd",
"Vale.X64.MemoryAdapters.as_vale_buffer",
"Vale.Inline.X64.Fadd_inline.fadd_pre",
"Prims.l_and",
"Vale.X64.Decls.eval_code",
"Vale.AsLowStar.ValeSig.vale_calling_conventions",
"Vale.Inline.X64.Fadd_inline.fadd_regs_modified",
"Vale.Inline.X64.Fadd_inline.fadd_xmms_modified",
"Vale.X64.Machine_s.reg_xmm",
"Vale.Inline.X64.Fadd_inline.fadd_post",
"Vale.X64.Memory.buffer_readable",
"Vale.X64.State.vs_get_vale_heap",
"Vale.X64.Memory.buffer_writeable",
"Vale.X64.Memory.modifies",
"Vale.X64.Memory.loc_union",
"Vale.X64.Memory.loc_buffer",
"Vale.X64.Memory.loc_none"
] | [] | false | false | false | false | false | let fadd_lemma' (code: V.va_code) (_win: bool) (out f1 f2: b64) (va_s0: V.va_state)
: Ghost (V.va_state & V.va_fuel)
(requires fadd_pre code out f1 f2 va_s0)
(ensures
(fun (va_s1, f) ->
V.eval_code code va_s0 f va_s1 /\
VSig.vale_calling_conventions va_s0 va_s1 fadd_regs_modified fadd_xmms_modified /\
fadd_post code out f1 f2 va_s0 va_s1 f /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\
ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\
ME.buffer_writeable (as_vale_buffer out) /\ ME.buffer_writeable (as_vale_buffer f1) /\
ME.buffer_writeable (as_vale_buffer f2) /\
ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)
(VS.vs_get_vale_heap va_s0)
(VS.vs_get_vale_heap va_s1))) =
| let va_s1, f =
FH.va_lemma_Fadd code va_s0 (as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2)
in
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;
Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;
(va_s1, f) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Pslld | val eval_Pslld (amt: int) (dst: quad32) : option quad32 | val eval_Pslld (amt: int) (dst: quad32) : option quad32 | let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 95,
"end_line": 136,
"start_col": 0,
"start_line": 135
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | amt: Prims.int -> dst: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Prims.int",
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_sse2",
"Prims.op_AmpAmp",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Pervasives.Native.Some",
"Vale.Def.Words.Four_s.four_map",
"Vale.Def.Words_s.natN",
"Vale.Def.Words_s.pow2_32",
"Vale.Def.Types_s.ishl",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Pslld (amt: int) (dst: quad32) : option quad32 =
| check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None) | false |
Vale.AES.X64.GCMdecryptOpt.fst | Vale.AES.X64.GCMdecryptOpt.va_wpProof_Gcm_extra_bytes | val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat ->
old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags;
va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat ->
old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags;
va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_extra_bytes (va_code_Gcm_extra_bytes alg) va_s0 alg inout_b key
round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10
va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 263,
"start_col": 0,
"start_line": 249
} | module Vale.AES.X64.GCMdecryptOpt
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GCM
open Vale.AES.GHash_s
open Vale.AES.GHash
open Vale.AES.GCM_s
open Vale.AES.X64.AES
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.Poly1305.Math
open Vale.AES.GCM_helpers
open Vale.AES.X64.GHash
open Vale.AES.X64.GCTR
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsStack
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.X64.GF128_Mul
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2.Bits_s
open Vale.AES.X64.AESopt
open Vale.AES.X64.AESGCM
open Vale.AES.X64.AESopt2
open Vale.Lib.Meta
open Vale.AES.X64.GCMencryptOpt
open Vale.AES.OptPublic
open Vale.Lib.Basic
#reset-options "--z3rlimit 20 --max_ifuel 0"
//-- Gcm_extra_bytes
val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_extra_bytes alg =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0)
(va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor
(va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_CNil ()))))))))))
val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_extra_bytes alg =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and
(va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat)
(old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit
(va_code_Gcm_extra_bytes alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range
1 1)) = 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRax) 0 Secret inout_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let
(hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s)
inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key
round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax)
(va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (()))))))))))))))
val va_lemma_Gcm_extra_bytes : va_b0:va_code -> va_s0:va_state -> alg:algorithm ->
inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) ->
h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_extra_bytes alg) va_s0 /\ va_get_ok va_s0 /\ (let
(len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b
inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b
len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM
(va_update_mem va_sM va_s0))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_extra_bytes va_b0 va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes
old_hash completed_quads h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_extra_bytes va_mods alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_extra_bytes alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 121 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (len:(va_int_range 1 1)) = 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 177 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 181 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE old_hash input_quads)))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\
Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b
inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax
va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\ (forall
(va_x_mem:vale_heap) (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm10:quad32) (va_x_heap5:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 5
va_x_heap5 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7
(va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRcx va_x_rcx (va_upd_mem va_x_mem va_s0)))))))))))))) in va_get_ok
va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==> va_k va_sM (())))
val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat ->
old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags;
va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Lib.Basic.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.GHash.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESopt.fsti.checked",
"Vale.AES.X64.AESGCM.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.GCM.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GCMdecryptOpt.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Lib.Basic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
alg: Vale.AES.AES_common_s.algorithm ->
inout_b: Vale.X64.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
total_bytes: Prims.nat ->
old_hash: Vale.X64.Decls.quad32 ->
completed_quads: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
h_LE: Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Prims.nat",
"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_flags",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Prims._assert",
"Vale.X64.Decls.va_state_eq",
"Vale.X64.Decls.va_update_flags",
"Vale.X64.Decls.va_update_mem_heaplet",
"Vale.X64.Decls.va_update_xmm",
"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.AES.X64.GCMdecryptOpt.va_lemma_Gcm_extra_bytes",
"Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_extra_bytes"
] | [] | false | false | false | false | false | let va_wpProof_Gcm_extra_bytes
alg
inout_b
key
round_keys
keys_b
hkeys_b
total_bytes
old_hash
completed_quads
h_LE
va_s0
va_k
=
| let va_sM, va_f0 =
va_lemma_Gcm_extra_bytes (va_code_Gcm_extra_bytes alg) va_s0 alg inout_b key round_keys keys_b
hkeys_b total_bytes old_hash completed_quads h_LE
in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_flags va_sM
(va_update_mem_heaplet 5
va_sM
(va_update_xmm 10
va_sM
(va_update_xmm 8
va_sM
(va_update_xmm 7
va_sM
(va_update_xmm 6
va_sM
(va_update_xmm 5
va_sM
(va_update_xmm 4
va_sM
(va_update_xmm 3
va_sM
(va_update_xmm 2
va_sM
(va_update_xmm 1
va_sM
(va_update_xmm 0
va_sM
(va_update_reg64 rR11
va_sM
(va_update_reg64 rRcx
va_sM
(va_update_ok va_sM
(va_update_mem va_sM va_s0))))))))
)))))))));
va_lemma_norm_mods ([
va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6;
va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0;
va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem
])
va_sM
va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.norm_typing_inverse | val norm_typing_inverse
(g:env) (e:term) (eff:_) (t0:term)
(d:typing g e eff t0)
(t1:term)
(#u:_)
(d1:tot_typing g t1 (tm_type u))
(steps:list norm_step)
: T.Tac (option (typing g e eff t1)) | val norm_typing_inverse
(g:env) (e:term) (eff:_) (t0:term)
(d:typing g e eff t0)
(t1:term)
(#u:_)
(d1:tot_typing g t1 (tm_type u))
(steps:list norm_step)
: T.Tac (option (typing g e eff t1)) | let norm_typing_inverse
(g:env) (e:term) (eff:_) (t0:term)
(d:typing g e eff t0)
(t1:term)
(#u:_)
(d1:tot_typing g t1 (tm_type u))
(steps:list norm_step)
: T.Tac (option (typing g e eff t1))
= let (| t1', t1'_typing, related_t1_t1' |) =
let d1 = Ghost.hide d1._0 in
Pulse.RuntimeUtils.norm_well_typed_term d1 steps
in
match Pulse.Readback.readback_ty t1' with
| Some t1_p ->
if TermEq.term_eq (elab_term t0) t1'
then (
let related_t1'_t1 = Ghost.hide (RT.Rel_sym _ _ _ related_t1_t1') in
Some (apply_conversion d related_t1'_t1)
)
else None
| _ -> None | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 15,
"end_line": 825,
"start_col": 0,
"start_line": 805
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r
let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res)
let comp_st_with_post (c:comp_st) (post:term)
: c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } =
match c with
| C_ST st -> C_ST { st with post }
| C_STGhost st -> C_STGhost { st with post }
| C_STAtomic i obs st -> C_STAtomic i obs {st with post}
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)
: option (st_equiv g c0 c2)
=
match d01 with
| ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 -> (
let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in
if x = y && eq_tm (comp_res c0) (comp_res c1)
then Some (
ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing
(RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)
(VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)
(VE_Trans _ _ _ _ eq_post_01 eq_post_12)
)
else None
)
| ST_TotEquiv g t1 t2 u typing eq ->
let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in
let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in
Some (ST_TotEquiv g t1 t3 u typing eq'')
let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c')
: st_typing g st c'
= match d with
| T_Equiv _ _ _ _ d0 eq' -> (
match st_equiv_trans eq' eq with
| None -> T_Equiv _ _ _ _ d eq
| Some eq'' -> T_Equiv _ _ _ _ d0 eq''
)
| _ -> T_Equiv _ _ _ _ d eq
let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { freevars post `Set.subset` freevars (comp_post c)})
(veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } ->
vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post)
= if eq_tm post (comp_post c) then d
else
let c' = comp_st_with_post c post in
let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let veq = veq x in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq
in
t_equiv d st_equiv
let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { comp_post c == tm_star post tm_emp})
: st_typing g t (comp_st_with_post c post)
= st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x))
let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t)
: Lemma
(requires
comp_post_matches_hint c post_hint /\
effect_annot_of_comp c == effect_annot_of_comp c' /\
comp_res c' == comp_res c /\
comp_u c' == comp_u c /\
comp_post c' == tm_star (comp_post c) tm_emp)
(ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\
comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c')
= ()
let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g p ctxt)
: tot_typing g p tm_vprop
= let _, bk = vprop_equiv_typing d in
bk ctxt_typing
let comp_with_pre (c:comp_st) (pre:term) =
match c with
| C_ST st -> C_ST { st with pre }
| C_STGhost st -> C_STGhost { st with pre }
| C_STAtomic i obs st -> C_STAtomic i obs {st with pre}
let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(pre:term)
(veq: vprop_equiv g (comp_pre c) pre)
: st_typing g t (comp_with_pre c pre)
= if eq_tm pre (comp_pre c) then d
else
let c' = comp_with_pre c pre in
let (| u_of, pre_typing, x, post_typing |) =
Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _)
in
t_equiv d st_equiv
#push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0"
let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term)
(k:continuation_elaborator g1 ctxt g2 ctxt1)
(d:vprop_equiv g2 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt g2 ctxt2 =
fun post_hint res ->
let (| st, c, st_d |) = res in
let st_d : st_typing g2 st c = st_d in
assert (comp_pre c == ctxt2);
let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in
k post_hint (| st, _, st_d' |)
#pop-options
let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g ctxt p)
: tot_typing g p tm_vprop
= let fwd, _ = vprop_equiv_typing d in
fwd ctxt_typing
#push-options "--z3rlimit_factor 4 --ifuel 1 --fuel 0"
let k_elab_equiv_prefix
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt)
(d:vprop_equiv g1 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt2 g2 ctxt =
fun post_hint res ->
let framing_token : frame_for_req_in_ctxt g1 ctxt2 ctxt1 =
let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in
(| tm_emp, emp_typing, d |)
in
let res = k post_hint res in
let (| st, c, st_d |) = res in
assert (comp_pre c == ctxt1);
(| _, _, st_equiv_pre st_d _ d |)
#pop-options
let k_elab_equiv
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt2)
(d1:vprop_equiv g1 ctxt1 ctxt1')
(d2:vprop_equiv g2 ctxt2 ctxt2')
: continuation_elaborator g1 ctxt1' g2 ctxt2' =
let k : continuation_elaborator g1 ctxt1 g2 ctxt2' =
k_elab_equiv_continuation k d2 in
let k : continuation_elaborator g1 ctxt1' g2 ctxt2' =
k_elab_equiv_prefix k d1 in
k
#push-options "--query_stats --fuel 2 --ifuel 2 --split_queries no --z3rlimit_factor 20"
open Pulse.PP
let continuation_elaborator_with_bind (#g:env) (ctxt:term)
(#c1:comp{stateful_comp c1})
(#e1:st_term)
(e1_typing:st_typing g e1 c1)
(ctxt_pre1_typing:tot_typing g (tm_star ctxt (comp_pre c1)) tm_vprop)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g
(tm_star ctxt (comp_pre c1))
(push_binding g (snd x) (fst x) (comp_res c1))
(tm_star (open_term (comp_post c1) (snd x)) ctxt)) =
let pre1 = comp_pre c1 in
let res1 = comp_res c1 in
let post1 = comp_post c1 in
let ctxt_typing = star_typing_inversion_l ctxt_pre1_typing in
// let p_prop = Metatheory.pure_typing_inversion pure_typing in
let v_eq = VE_Comm g ctxt pre1 in
let framing_token : frame_for_req_in_ctxt g (tm_star ctxt pre1) pre1 =
(| ctxt, ctxt_typing, VE_Comm g pre1 ctxt |)
in
let (| c1, e1_typing |) =
apply_frame ctxt_pre1_typing e1_typing framing_token in
let (| u_of_1, pre_typing, _, _ |) =
Metatheory.(st_comp_typing_inversion (fst <| comp_typing_inversion (st_typing_correctness e1_typing))) in
let b = res1 in
let ppname, x = x in
let g' = push_binding g x ppname b in
let post1_opened = open_term_nv post1 (v_as_nv x) in
let k : continuation_elaborator g (tm_star ctxt pre1) g' (tm_star post1_opened ctxt) =
fun post_hint res ->
let (| e2, c2, e2_typing |) = res in
assert (comp_post_matches_hint c2 post_hint);
let e2_typing : st_typing g' e2 c2 = e2_typing in
let e2_closed = close_st_term e2 x in
assume (open_st_term e2_closed x == e2);
assert (comp_pre c1 == (tm_star ctxt pre1));
assert (comp_post c1 == tm_star post1 ctxt);
assert (comp_pre c2 == tm_star post1_opened ctxt);
assert (open_term (comp_post c1) x == tm_star post1_opened (open_term ctxt x));
// ctxt is well-typed, hence ln
assume (open_term ctxt x == ctxt);
assert (open_term (comp_post c1) x == comp_pre c2);
// we closed e2 with x
assume (~ (x `Set.mem` freevars_st e2_closed));
if x `Set.mem` freevars (comp_post c2)
then fail g' None "Impossible: freevar clash when constructing continuation elaborator for bind, please file a bug-report"
else (
let t_typing, post_typing =
Pulse.Typing.Combinators.bind_res_and_post_typing g c2 x post_hint in
let g = push_context g "mk_bind" e1.range in
// info_doc g None
// [prefix 4 1 (doc_of_string "mk_bind e1 = ") (doc_of_string (Pulse.Syntax.Printer.st_term_to_string e1));
// prefix 4 1 (doc_of_string "mk_bind c1 = ") (pp #comp c1);
// prefix 4 1 (doc_of_string "mk_bind e2 = ") (doc_of_string (Pulse.Syntax.Printer.st_term_to_string e2));
// prefix 4 1 (doc_of_string "mk_bind c2 = ") (pp #comp c2)]
// ;
let (| e, c, e_typing |) =
Pulse.Typing.Combinators.mk_bind
g (tm_star ctxt pre1)
e1 e2_closed c1 c2 (ppname, x) e1_typing
u_of_1
e2_typing
t_typing
post_typing
(Some? post_hint)
in
(| e, c, e_typing |)
)
in
k
#pop-options
module LN = Pulse.Typing.LN
#push-options "--z3rlimit_factor 4 --fuel 1 --ifuel 1"
let st_comp_typing_with_post_hint
(#g:env) (#ctxt:_)
(ctxt_typing:tot_typing g ctxt tm_vprop)
(post_hint:post_hint_opt g { Some? post_hint })
(c:comp_st { comp_pre c == ctxt /\ comp_post_matches_hint c post_hint })
: st_comp_typing g (st_comp_of_comp c)
= let st = st_comp_of_comp c in
let Some ph = post_hint in
let post_typing_src
: tot_typing (push_binding ph.g ph.x ppname_default ph.ret_ty)
(open_term ph.post ph.x) tm_vprop
= ph.post_typing_src
in
let x = fresh g in
assume (fresh_wrt x g (freevars ph.post));
assume (None? (lookup g ph.x));
let post_typing_src
: tot_typing (push_binding ph.g x ppname_default ph.ret_ty)
(open_term ph.post x) tm_vprop
= if x = ph.x
then post_typing_src
else
let open Pulse.Typing.Metatheory.Base in
let tt :
tot_typing
(push_binding ph.g x ppname_default ph.ret_ty)
(subst_term (open_term ph.post ph.x) (renaming ph.x x))
(subst_term tm_vprop (renaming ph.x x)) =
tot_typing_renaming1 ph.g ph.x ph.ret_ty (open_term ph.post ph.x) tm_vprop post_typing_src x
in
assert (subst_term tm_vprop (renaming ph.x x) == tm_vprop);
assume (subst_term (open_term ph.post ph.x) (renaming ph.x x) ==
open_term ph.post x);
tt
in
let post_typing_src
: tot_typing (push_binding g x ppname_default ph.ret_ty)
(open_term ph.post x) tm_vprop
= //weakening: TODO
RU.magic ()
in
let ty_typing : universe_of ph.g st.res st.u = ph.ty_typing in
let ty_typing : universe_of g st.res st.u =
Pulse.Typing.Metatheory.tot_typing_weakening_standard ph.g ty_typing g
in
assert (st.res == ph.ret_ty);
assert (st.post == ph.post);
STC g st x ty_typing ctxt_typing post_typing_src
let continuation_elaborator_with_bind_fn (#g:env) (#ctxt:term)
(ctxt_typing:tot_typing g ctxt tm_vprop)
(#e1:st_term)
(#c1:comp { C_Tot? c1 })
(b:binder{b.binder_ty == comp_res c1})
(e1_typing:st_typing g e1 c1)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g ctxt
(push_binding g (snd x) ppname_default (comp_res c1)) ctxt)
= let t1 = comp_res c1 in
assert ((push_binding g (snd x) (fst x) t1) `env_extends` g);
fun post_hint (| e2, c2, d2 |) ->
if None? post_hint then T.fail "bind_fn: expects the post_hint to be set";
let ppname, x = x in
let e2_closed = close_st_term e2 x in
assume (open_st_term (close_st_term e2 x) x == e2);
let e = wr c2 (Tm_Bind {binder=b; head=e1; body=e2_closed}) in
let (| u, c1_typing |) = Pulse.Typing.Metatheory.Base.st_typing_correctness_ctot e1_typing in
let c2_typing : comp_typing g c2 (universe_of_comp c2) =
match c2 with
| C_ST st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
let i_typing = CP.core_check_term g i T.E_Total tm_inames in
CT_STAtomic _ _ obs _ i_typing stc
| C_STGhost st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
CT_STGhost _ _ stc
in
let d : st_typing g e c2 =
T_BindFn g e1 e2_closed c1 c2 b x e1_typing u c1_typing d2 c2_typing
in
(| e, c2, d |)
let rec check_equiv_emp (g:env) (vp:term)
: option (vprop_equiv g vp tm_emp)
= match vp.t with
| Tm_Emp -> Some (VE_Refl _ _)
| Tm_Star vp1 vp2 ->
(match check_equiv_emp g vp1, check_equiv_emp g vp2 with
| Some d1, Some d2 ->
let d3 : vprop_equiv g (tm_star vp1 vp2) (tm_star tm_emp tm_emp)
= VE_Ctxt _ _ _ _ _ d1 d2 in
let d4 : vprop_equiv g (tm_star tm_emp tm_emp) tm_emp =
VE_Unit _ _ in
Some (VE_Trans _ _ _ _ d3 d4)
| _, _ -> None)
| _ -> None
let emp_inames_included (g:env) (i:term) (_:tot_typing g i tm_inames)
: prop_validity g (tm_inames_subset tm_emp_inames i)
= RU.magic()
let return_in_ctxt (g:env) (y:var) (y_ppname:ppname) (u:universe) (ty:term) (ctxt:vprop)
(ty_typing:universe_of g ty u)
(post_hint0:post_hint_opt g { Some? post_hint0 /\ checker_res_matches_post_hint g post_hint0 y ty ctxt})
: Pure (st_typing_in_ctxt g ctxt post_hint0)
(requires lookup g y == Some ty)
(ensures fun _ -> True)
= let Some post_hint = post_hint0 in
let x = fresh g in
assume (~ (x `Set.mem` freevars post_hint.post));
let ctag =
match post_hint.effect_annot with
| EffectAnnotAtomic _ -> STT_Atomic
| EffectAnnotGhost -> STT_Ghost
| _ -> STT
in
let y_tm = tm_var {nm_index=y;nm_ppname=y_ppname} in
let d = T_Return g ctag false u ty y_tm post_hint.post x ty_typing
(RU.magic ()) // that null_var y is well typed at ty in g, we know since lookup g y == Some ty
(RU.magic ()) // typing of (open post x) in (g, x) ... post_hint is well-typed, so should get
in
let t = wtag (Some ctag) (Tm_Return {expected_type=tm_unknown;insert_eq=false;term=y_tm}) in
let c = comp_return ctag false u ty y_tm post_hint.post x in
let d : st_typing g t c = d in
assume (comp_u c == post_hint.u); // this u should follow from equality of t
match c, post_hint.effect_annot with
| C_STAtomic _ obs _, EffectAnnotAtomic { opens } ->
assert (comp_inames c == tm_emp_inames);
let pht = post_hint_typing g post_hint x in
let validity = emp_inames_included g opens pht.effect_annot_typing in
let d = T_Sub _ _ _ _ d (STS_AtomicInvs _ (st_comp_of_comp c) tm_emp_inames opens obs obs validity) in
(| _, _, d |)
| _ ->
(| _, _, d |)
let match_comp_res_with_post_hint (#g:env) (#t:st_term) (#c:comp_st)
(d:st_typing g t c)
(post_hint:post_hint_opt g)
: T.Tac (t':st_term &
c':comp_st &
st_typing g t' c') =
match post_hint with
| None -> (| t, c, d |)
| Some { ret_ty } ->
let cres = comp_res c in
if eq_tm cres ret_ty
then (| t, c, d |)
else match Pulse.Checker.Pure.check_equiv g cres ret_ty with
| None ->
fail g (Some t.range)
(Printf.sprintf "Could not prove equiv for computed type %s and expected type %s"
(P.term_to_string cres)
(P.term_to_string ret_ty))
| Some tok ->
let d_equiv
: RT.equiv _ (elab_term cres) (elab_term ret_ty) =
RT.Rel_eq_token _ _ _ (FStar.Squash.return_squash tok) in
let c' = with_st_comp c {(st_comp_of_comp c) with res = ret_ty } in
let (| cres_typing, cpre_typing, x, cpost_typing |) =
st_comp_typing_inversion (fst <| comp_typing_inversion (st_typing_correctness d)) in
let d_stequiv : st_equiv g c c' =
ST_VPropEquiv _ c c' _ cpre_typing cres_typing cpost_typing d_equiv (VE_Refl _ _) (VE_Refl _ _)
in
(| t, c', T_Equiv _ _ _ _ d d_stequiv |)
let apply_checker_result_k (#g:env) (#ctxt:vprop) (#post_hint:post_hint_for_env g)
(r:checker_result_t g ctxt (Some post_hint))
(res_ppname:ppname)
: T.Tac (st_typing_in_ctxt g ctxt (Some post_hint)) =
// TODO: FIXME add to checker result type?
let (| y, g1, (| u_ty, ty_y, d_ty_y |), (| pre', _ |), k |) = r in
let (| u_ty_y, d_ty_y |) = Pulse.Checker.Pure.check_universe g1 ty_y in
let d : st_typing_in_ctxt g1 pre' (Some post_hint) =
return_in_ctxt g1 y res_ppname u_ty_y ty_y pre' d_ty_y (Some post_hint) in
k (Some post_hint) d
#push-options "--z3rlimit_factor 4 --fuel 0 --ifuel 1 --query_stats"
let checker_result_for_st_typing (#g:env) (#ctxt:vprop) (#post_hint:post_hint_opt g)
(d:st_typing_in_ctxt g ctxt post_hint)
(ppname:ppname)
: T.Tac (checker_result_t g ctxt post_hint) =
let (| t, c, d |) = d in
let x = fresh g in
let g' = push_binding g x ppname (comp_res c) in
let ctxt' = open_term_nv (comp_post c) (ppname, x) in
let k
: continuation_elaborator
g (tm_star tm_emp (comp_pre c))
g' (tm_star ctxt' tm_emp) =
continuation_elaborator_with_bind tm_emp d (RU.magic ()) (ppname, x) in
let k
: continuation_elaborator g (comp_pre c) g' ctxt' =
k_elab_equiv k (RU.magic ()) (RU.magic ()) in
let _ : squash (checker_res_matches_post_hint g post_hint x (comp_res c) ctxt') =
match post_hint with
| None -> ()
| Some post_hint -> () in
assert (g' `env_extends` g);
let comp_res_typing, _, f =
Metatheory.(st_comp_typing_inversion_cofinite (fst <| comp_typing_inversion (st_typing_correctness d))) in
// RU.magic is the typing of comp_res in g'
// weaken comp_res_typing
assume (~ (x `Set.mem` freevars (comp_post c)));
let tt : universe_of _ _ _ = RU.magic () in
(| x, g', (| comp_u c, comp_res c, tt |), (| ctxt', f x |), k |)
#pop-options
module R = FStar.Reflection.V2
let readback_comp_res_as_comp (c:T.comp) : option comp =
match c with
| T.C_Total t -> (
match readback_comp t with
| None -> None
| Some c -> Some c
)
| _ -> None
let rec is_stateful_arrow (g:env) (c:option comp) (args:list T.argv) (out:list T.argv)
: T.Tac (option (list T.argv & T.argv))
= let open R in
match c with
| None -> None
| Some (C_ST _)
| Some (C_STGhost _)
| Some (C_STAtomic _ _ _) -> (
match args, out with
| [], hd::tl -> Some (List.rev tl, hd)
| _ -> None //leftover or not enough args
)
| Some (C_Tot c_res) -> (
if not (Tm_FStar? c_res.t)
then None
else (
let Tm_FStar c_res = c_res.t in
let ht = T.inspect c_res in
match ht with
| T.Tv_Arrow b c -> (
match args with
| [] -> ( //no more args; check that only implicits remain, ending in an stateful comp
let bs, c = T.collect_arr_ln_bs c_res in
if List.Tot.for_all (fun b -> R.Q_Implicit? (R.inspect_binder b).qual) bs
then is_stateful_arrow g (readback_comp_res_as_comp (R.inspect_comp c)) [] out
else None //too few args
)
| (arg, qual)::args' -> ( //check that this arg qual matches the binder and recurse accordingly
match b.qual, qual with
| T.Q_Meta _, T.Q_Implicit
| T.Q_Implicit, T.Q_Implicit
| T.Q_Explicit, T.Q_Explicit -> //consume this argument
is_stateful_arrow g (readback_comp_res_as_comp c) args' ((arg, qual)::out)
| T.Q_Meta _, T.Q_Explicit
| T.Q_Implicit, T.Q_Explicit ->
//don't consume this argument
is_stateful_arrow g (readback_comp_res_as_comp c) args out
| _ -> None //incompatible qualifiers; bail
)
)
| _ ->
let c_res' = RU.whnf_lax (elab_env g) c_res in
let ht = T.inspect c_res' in
if T.Tv_Arrow? ht
then (
assume (not_tv_unknown c_res');
let c_res' = tm_fstar c_res' (T.range_of_term c_res') in
is_stateful_arrow g (Some (C_Tot c_res')) args out
)
else None
)
)
module RU = Pulse.RuntimeUtils
let is_stateful_application (g:env) (e:term)
: T.Tac (option st_term)
= match e.t with
| Tm_FStar host_term -> (
let head, args = T.collect_app_ln host_term in
assume (not_tv_unknown head);
match RU.lax_check_term_with_unknown_universes (elab_env g) head with
| None -> None
| Some ht ->
assume (not_tv_unknown ht);
let head_t = tm_fstar ht (T.range_of_term ht) in
match is_stateful_arrow g (Some (C_Tot head_t)) args [] with
| None -> None
| Some (applied_args, (last_arg, aqual))->
let head = T.mk_app head applied_args in
assume (not_tv_unknown head);
let head = tm_fstar head (T.range_of_term head) in
assume (not_tv_unknown last_arg);
let last_arg = tm_fstar last_arg (T.range_of_term last_arg) in
let qual =
match aqual with
| T.Q_Implicit -> Some Implicit
| _ -> None
in
let st_app = Tm_STApp { head; arg=last_arg; arg_qual=qual} in
let st_app = { term = st_app; range=e.range; effect_tag=default_effect_hint } in
Some st_app
)
| _ -> None
let apply_conversion
(#g:env) (#e:term) (#eff:_) (#t0:term)
(d:typing g e eff t0)
(#t1:term)
(eq:Ghost.erased (RT.related (elab_env g) (elab_term t0) RT.R_Eq (elab_term t1)))
: typing g e eff t1
= let d : RT.typing (elab_env g) (elab_term e) (eff, (elab_term t0)) = d._0 in
let r : RT.related (elab_env g) (elab_term t0) RT.R_Eq (elab_term t1) = eq in
let r = RT.Rel_equiv _ _ _ RT.R_Sub r in
let s : RT.sub_comp (elab_env g) (eff, (elab_term t0)) (eff, elab_term t1) =
RT.Relc_typ _ _ _ _ _ r
in
E (RT.T_Sub _ _ _ _ d s)
let norm_typing
(g:env) (e:term) (eff:_) (t0:term)
(d:typing g e eff t0)
(steps:list norm_step)
: T.Tac (t':term & typing g e eff t')
= let t = elab_term t0 in
let u_t_typing : Ghost.erased (u:R.universe & RT.typing _ _ _) =
Pulse.Typing.Metatheory.Base.typing_correctness d._0
in
let (| t', t'_typing, related_t_t' |) =
Pulse.RuntimeUtils.norm_well_typed_term (dsnd u_t_typing) steps
in
match Pulse.Readback.readback_ty t' with
| None -> T.fail "Could not readback normalized type"
| Some t'' ->
let d : typing g e eff t'' = apply_conversion d related_t_t' in
(| t'', d |) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Typing.LN",
"short_module": "LN"
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
g: Pulse.Typing.Env.env ->
e: Pulse.Syntax.Base.term ->
eff: FStar.Stubs.TypeChecker.Core.tot_or_ghost ->
t0: Pulse.Syntax.Base.term ->
d: Pulse.Typing.typing g e eff t0 ->
t1: Pulse.Syntax.Base.term ->
d1: Pulse.Typing.tot_typing g t1 (Pulse.Syntax.Pure.tm_type u553) ->
steps: Prims.list FStar.Pervasives.norm_step
-> FStar.Tactics.Effect.Tac (FStar.Pervasives.Native.option (Pulse.Typing.typing g e eff t1)) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"FStar.Stubs.TypeChecker.Core.tot_or_ghost",
"Pulse.Typing.typing",
"Pulse.Syntax.Base.universe",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Pure.tm_type",
"Prims.list",
"FStar.Pervasives.norm_step",
"FStar.Stubs.Reflection.Types.term",
"FStar.Ghost.erased",
"FStar.Reflection.Typing.typing",
"Pulse.Typing.elab_env",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Stubs.TypeChecker.Core.E_Total",
"FStar.Ghost.reveal",
"FStar.Ghost.hide",
"Pulse.Elaborate.Pure.elab_term",
"FStar.Reflection.Typing.related",
"FStar.Reflection.Typing.R_Eq",
"Pulse.Readback.readback_ty",
"Prims.eq2",
"FStar.Reflection.V2.TermEq.term_eq",
"FStar.Pervasives.Native.Some",
"Pulse.Checker.Base.apply_conversion",
"FStar.Reflection.Typing.Rel_sym",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.dtuple3",
"Pulse.RuntimeUtils.norm_well_typed_term",
"Pulse.Typing.__proj__E__item___0"
] | [] | false | true | false | false | false | let norm_typing_inverse
(g: env)
(e: term)
(eff: _)
(t0: term)
(d: typing g e eff t0)
(t1: term)
(#u: _)
(d1: tot_typing g t1 (tm_type u))
(steps: list norm_step)
: T.Tac (option (typing g e eff t1)) =
| let (| t1' , t1'_typing , related_t1_t1' |) =
let d1 = Ghost.hide d1._0 in
Pulse.RuntimeUtils.norm_well_typed_term d1 steps
in
match Pulse.Readback.readback_ty t1' with
| Some t1_p ->
if TermEq.term_eq (elab_term t0) t1'
then
(let related_t1'_t1 = Ghost.hide (RT.Rel_sym _ _ _ related_t1_t1') in
Some (apply_conversion d related_t1'_t1))
else None
| _ -> None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_VPaddd | val eval_VPaddd (src1 src2: quad32) : option quad32 | val eval_VPaddd (src1 src2: quad32) : option quad32 | let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 89,
"end_line": 132,
"start_col": 0,
"start_line": 132
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_avx",
"Vale.X64.Instructions_s.eval_Paddd_raw",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_VPaddd (src1 src2: quad32) : option quad32 =
| check_avx (eval_Paddd_raw src1 src2) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Palignr_raw | val eval_Palignr_raw (amount: nat8) (src1 src2: quad32) : option quad32 | val eval_Palignr_raw (amount: nat8) (src1 src2: quad32) : option quad32 | let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 158,
"start_col": 0,
"start_line": 152
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | amount: Vale.Def.Types_s.nat8 -> src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.Def.Types_s.nat8",
"Vale.X64.Machine_s.quad32",
"Prims.op_Equality",
"Prims.int",
"FStar.Pervasives.Native.Some",
"Vale.Def.Words_s.Mkfour",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Palignr_raw (amount: nat8) (src1 src2: quad32) : option quad32 =
| if amount = 4
then Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1) else None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Paddd | val eval_Paddd (src1 src2: quad32) : option quad32 | val eval_Paddd (src1 src2: quad32) : option quad32 | let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 89,
"end_line": 129,
"start_col": 0,
"start_line": 129
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32)) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_sse2",
"Vale.X64.Instructions_s.eval_Paddd_raw",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Paddd (src1 src2: quad32) : option quad32 =
| check_sse2 (eval_Paddd_raw src1 src2) | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.k_elab_equiv_prefix | val k_elab_equiv_prefix
(#g1: env)
(#g2: env{g2 `env_extends` g1})
(#ctxt1 #ctxt2 #ctxt: term)
(k: continuation_elaborator g1 ctxt1 g2 ctxt)
(d: vprop_equiv g1 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt2 g2 ctxt | val k_elab_equiv_prefix
(#g1: env)
(#g2: env{g2 `env_extends` g1})
(#ctxt1 #ctxt2 #ctxt: term)
(k: continuation_elaborator g1 ctxt1 g2 ctxt)
(d: vprop_equiv g1 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt2 g2 ctxt | let k_elab_equiv_prefix
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt)
(d:vprop_equiv g1 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt2 g2 ctxt =
fun post_hint res ->
let framing_token : frame_for_req_in_ctxt g1 ctxt2 ctxt1 =
let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in
(| tm_emp, emp_typing, d |)
in
let res = k post_hint res in
let (| st, c, st_d |) = res in
assert (comp_pre c == ctxt1);
(| _, _, st_equiv_pre st_d _ d |) | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 35,
"end_line": 345,
"start_col": 0,
"start_line": 332
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r
let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res)
let comp_st_with_post (c:comp_st) (post:term)
: c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } =
match c with
| C_ST st -> C_ST { st with post }
| C_STGhost st -> C_STGhost { st with post }
| C_STAtomic i obs st -> C_STAtomic i obs {st with post}
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)
: option (st_equiv g c0 c2)
=
match d01 with
| ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 -> (
let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in
if x = y && eq_tm (comp_res c0) (comp_res c1)
then Some (
ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing
(RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)
(VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)
(VE_Trans _ _ _ _ eq_post_01 eq_post_12)
)
else None
)
| ST_TotEquiv g t1 t2 u typing eq ->
let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in
let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in
Some (ST_TotEquiv g t1 t3 u typing eq'')
let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c')
: st_typing g st c'
= match d with
| T_Equiv _ _ _ _ d0 eq' -> (
match st_equiv_trans eq' eq with
| None -> T_Equiv _ _ _ _ d eq
| Some eq'' -> T_Equiv _ _ _ _ d0 eq''
)
| _ -> T_Equiv _ _ _ _ d eq
let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { freevars post `Set.subset` freevars (comp_post c)})
(veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } ->
vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post)
= if eq_tm post (comp_post c) then d
else
let c' = comp_st_with_post c post in
let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let veq = veq x in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq
in
t_equiv d st_equiv
let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { comp_post c == tm_star post tm_emp})
: st_typing g t (comp_st_with_post c post)
= st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x))
let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t)
: Lemma
(requires
comp_post_matches_hint c post_hint /\
effect_annot_of_comp c == effect_annot_of_comp c' /\
comp_res c' == comp_res c /\
comp_u c' == comp_u c /\
comp_post c' == tm_star (comp_post c) tm_emp)
(ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\
comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c')
= ()
let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g p ctxt)
: tot_typing g p tm_vprop
= let _, bk = vprop_equiv_typing d in
bk ctxt_typing
let comp_with_pre (c:comp_st) (pre:term) =
match c with
| C_ST st -> C_ST { st with pre }
| C_STGhost st -> C_STGhost { st with pre }
| C_STAtomic i obs st -> C_STAtomic i obs {st with pre}
let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(pre:term)
(veq: vprop_equiv g (comp_pre c) pre)
: st_typing g t (comp_with_pre c pre)
= if eq_tm pre (comp_pre c) then d
else
let c' = comp_with_pre c pre in
let (| u_of, pre_typing, x, post_typing |) =
Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _)
in
t_equiv d st_equiv
#push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0"
let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term)
(k:continuation_elaborator g1 ctxt g2 ctxt1)
(d:vprop_equiv g2 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt g2 ctxt2 =
fun post_hint res ->
let (| st, c, st_d |) = res in
let st_d : st_typing g2 st c = st_d in
assert (comp_pre c == ctxt2);
let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in
k post_hint (| st, _, st_d' |)
#pop-options
let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g ctxt p)
: tot_typing g p tm_vprop
= let fwd, _ = vprop_equiv_typing d in
fwd ctxt_typing | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
k: Pulse.Checker.Base.continuation_elaborator g1 ctxt1 g2 ctxt ->
d: Pulse.Typing.vprop_equiv g1 ctxt1 ctxt2
-> Pulse.Checker.Base.continuation_elaborator g1 ctxt2 g2 ctxt | Prims.Tot | [
"total"
] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Typing.Env.env_extends",
"Pulse.Syntax.Base.term",
"Pulse.Checker.Base.continuation_elaborator",
"Pulse.Typing.vprop_equiv",
"Pulse.Typing.post_hint_opt",
"Pulse.Typing.Combinators.st_typing_in_ctxt",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp_st",
"Prims.l_and",
"Prims.eq2",
"Pulse.Syntax.Base.vprop",
"Pulse.Syntax.Base.comp_pre",
"Pulse.Typing.comp_post_matches_hint",
"Pulse.Typing.st_typing",
"FStar.Pervasives.Mkdtuple3",
"Pulse.Checker.Base.comp_with_pre",
"Pulse.Checker.Base.st_equiv_pre",
"Prims.unit",
"Prims._assert",
"Pulse.Typing.Combinators.frame_for_req_in_ctxt",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Syntax.Base.tm_star",
"Pulse.Syntax.Base.tm_emp",
"Pulse.Typing.emp_typing",
"Pulse.Typing.VE_Trans",
"Pulse.Typing.VE_Comm",
"Pulse.Typing.VE_Unit"
] | [] | false | false | false | false | false | let k_elab_equiv_prefix
(#g1: env)
(#g2: env{g2 `env_extends` g1})
(#ctxt1 #ctxt2 #ctxt: term)
(k: continuation_elaborator g1 ctxt1 g2 ctxt)
(d: vprop_equiv g1 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt2 g2 ctxt =
| fun post_hint res ->
let framing_token:frame_for_req_in_ctxt g1 ctxt2 ctxt1 =
let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in
(| tm_emp, emp_typing, d |)
in
let res = k post_hint res in
let (| st , c , st_d |) = res in
assert (comp_pre c == ctxt1);
(| _, _, st_equiv_pre st_d _ d |) | false |
Vale.AES.X64.GCMdecryptOpt.fst | Vale.AES.X64.GCMdecryptOpt.va_quick_Gcm_blocks128 | val va_quick_Gcm_blocks128
(alg: algorithm)
(in_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(h_LE: quad32)
: (va_quickCode unit (va_code_Gcm_blocks128 alg)) | val va_quick_Gcm_blocks128
(alg: algorithm)
(in_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(h_LE: quad32)
: (va_quickCode unit (va_code_Gcm_blocks128 alg)) | let va_quick_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) : (va_quickCode
unit (va_code_Gcm_blocks128 alg)) =
(va_QProc (va_code_Gcm_blocks128 alg) ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10;
va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64
rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem])
(va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE)
(va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE)) | {
"file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 81,
"end_line": 492,
"start_col": 0,
"start_line": 484
} | module Vale.AES.X64.GCMdecryptOpt
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GCM
open Vale.AES.GHash_s
open Vale.AES.GHash
open Vale.AES.GCM_s
open Vale.AES.X64.AES
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.Poly1305.Math
open Vale.AES.GCM_helpers
open Vale.AES.X64.GHash
open Vale.AES.X64.GCTR
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsStack
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.X64.GF128_Mul
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2.Bits_s
open Vale.AES.X64.AESopt
open Vale.AES.X64.AESGCM
open Vale.AES.X64.AESopt2
open Vale.Lib.Meta
open Vale.AES.X64.GCMencryptOpt
open Vale.AES.OptPublic
open Vale.Lib.Basic
#reset-options "--z3rlimit 20 --max_ifuel 0"
//-- Gcm_extra_bytes
val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_extra_bytes alg =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0)
(va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor
(va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_CNil ()))))))))))
val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_extra_bytes alg =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and
(va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat)
(old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit
(va_code_Gcm_extra_bytes alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range
1 1)) = 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRax) 0 Secret inout_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let
(hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s)
inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key
round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax)
(va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (()))))))))))))))
val va_lemma_Gcm_extra_bytes : va_b0:va_code -> va_s0:va_state -> alg:algorithm ->
inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) ->
h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_extra_bytes alg) va_s0 /\ va_get_ok va_s0 /\ (let
(len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b
inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b
len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM
(va_update_mem va_sM va_s0))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_extra_bytes va_b0 va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes
old_hash completed_quads h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_extra_bytes va_mods alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_extra_bytes alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 121 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (len:(va_int_range 1 1)) = 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 177 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 181 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE old_hash input_quads)))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\
Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b
inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax
va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\ (forall
(va_x_mem:vale_heap) (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm10:quad32) (va_x_heap5:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 5
va_x_heap5 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7
(va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRcx va_x_rcx (va_upd_mem va_x_mem va_s0)))))))))))))) in va_get_ok
va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==> va_k va_sM (())))
val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat ->
old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags;
va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_extra_bytes (va_code_Gcm_extra_bytes alg) va_s0 alg inout_b key
round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10
va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_extra_bytes alg)) =
(va_QProc (va_code_Gcm_extra_bytes alg) ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem])
(va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE) (va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE))
//--
//-- Gcm_blocks128
val va_code_Gcm_blocks128 : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks128 alg =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_CCons
(va_code_Ghash_buffer ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi)
(va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdx)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Gctr_blocks128 alg) (va_CNil ())))))))))
val va_codegen_success_Gcm_blocks128 : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks128 alg =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Ghash_buffer ()) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Gctr_blocks128 alg) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks128 (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128)
(key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32)
: (va_quickCode unit (va_code_Gcm_blocks128 alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 274 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 275 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 277 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_buffer hkeys_b in_b h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_old_s))) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gctr_blocks128 alg in_b out_b key round_keys keys_b) (va_QEmpty (()))))))))))
val va_lemma_Gcm_blocks128 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 ->
out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks128 alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 10 va_sM (va_update_xmm 11 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR11 va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks128 va_b0 va_s0 alg in_b out_b key round_keys keys_b hkeys_b h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks128 va_mods alg in_b out_b key round_keys keys_b hkeys_b h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks128 alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 210 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 255 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 261 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 262 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx
va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 265 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) out_b)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 267 column 131 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==>
FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64) (va_x_rdi:nat64) (va_x_r11:nat64)
(va_x_r10:nat64) (va_x_rdx:nat64) (va_x_r12:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm11:quad32) (va_x_xmm10:quad32)
(va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64
rR10 va_x_r10 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRbx
va_x_rbx (va_upd_mem va_x_mem va_s0))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) ==> va_k va_sM (())))
val va_wpProof_Gcm_blocks128 : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> h_LE:quad32 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b
h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks128 alg) ([va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6;
va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0;
va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi;
va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_blocks128 (va_code_Gcm_blocks128 alg) va_s0 alg in_b out_b key
round_keys keys_b hkeys_b h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 10
va_sM (va_update_xmm 11 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2
va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR12 va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Lib.Basic.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.GHash.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESopt.fsti.checked",
"Vale.AES.X64.AESGCM.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.GCM.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GCMdecryptOpt.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Lib.Basic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
alg: Vale.AES.AES_common_s.algorithm ->
in_b: Vale.X64.Memory.buffer128 ->
out_b: Vale.X64.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
h_LE: Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Prims.unit
(Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_blocks128 alg) | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_blocks128",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rR10",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.AES.X64.GCMdecryptOpt.va_wp_Gcm_blocks128",
"Vale.AES.X64.GCMdecryptOpt.va_wpProof_Gcm_blocks128",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Gcm_blocks128
(alg: algorithm)
(in_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(h_LE: quad32)
: (va_quickCode unit (va_code_Gcm_blocks128 alg)) =
| (va_QProc (va_code_Gcm_blocks128 alg)
([
va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7;
va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11;
va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem
])
(va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE)
(va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE)) | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.st_equiv_post | val st_equiv_post
(#g: env)
(#t: st_term)
(#c: comp_st)
(d: st_typing g t c)
(post: term{(freevars post) `Set.subset` (freevars (comp_post c))})
(veq:
(x: var{fresh_wrt x g (freevars (comp_post c))}
-> vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post) | val st_equiv_post
(#g: env)
(#t: st_term)
(#c: comp_st)
(d: st_typing g t c)
(post: term{(freevars post) `Set.subset` (freevars (comp_post c))})
(veq:
(x: var{fresh_wrt x g (freevars (comp_post c))}
-> vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post) | let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { freevars post `Set.subset` freevars (comp_post c)})
(veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } ->
vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post)
= if eq_tm post (comp_post c) then d
else
let c' = comp_st_with_post c post in
let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let veq = veq x in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq
in
t_equiv d st_equiv | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 24,
"end_line": 265,
"start_col": 0,
"start_line": 250
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r
let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res)
let comp_st_with_post (c:comp_st) (post:term)
: c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } =
match c with
| C_ST st -> C_ST { st with post }
| C_STGhost st -> C_STGhost { st with post }
| C_STAtomic i obs st -> C_STAtomic i obs {st with post}
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)
: option (st_equiv g c0 c2)
=
match d01 with
| ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 -> (
let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in
if x = y && eq_tm (comp_res c0) (comp_res c1)
then Some (
ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing
(RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)
(VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)
(VE_Trans _ _ _ _ eq_post_01 eq_post_12)
)
else None
)
| ST_TotEquiv g t1 t2 u typing eq ->
let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in
let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in
Some (ST_TotEquiv g t1 t3 u typing eq'')
let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c')
: st_typing g st c'
= match d with
| T_Equiv _ _ _ _ d0 eq' -> (
match st_equiv_trans eq' eq with
| None -> T_Equiv _ _ _ _ d eq
| Some eq'' -> T_Equiv _ _ _ _ d0 eq''
)
| _ -> T_Equiv _ _ _ _ d eq | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
d: Pulse.Typing.st_typing g t c ->
post:
Pulse.Syntax.Base.term
{ FStar.Set.subset (Pulse.Syntax.Naming.freevars post)
(Pulse.Syntax.Naming.freevars (Pulse.Syntax.Base.comp_post c)) } ->
veq:
(
x:
Pulse.Syntax.Base.var
{ Pulse.Typing.fresh_wrt x
g
(Pulse.Syntax.Naming.freevars (Pulse.Syntax.Base.comp_post c)) }
-> Pulse.Typing.vprop_equiv (Pulse.Typing.Env.push_binding g
x
Pulse.Syntax.Base.ppname_default
(Pulse.Syntax.Base.comp_res c))
(Pulse.Syntax.Naming.open_term (Pulse.Syntax.Base.comp_post c) x)
(Pulse.Syntax.Naming.open_term post x))
-> Pulse.Typing.st_typing g t (Pulse.Checker.Base.comp_st_with_post c post) | Prims.Tot | [
"total"
] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp_st",
"Pulse.Typing.st_typing",
"Pulse.Syntax.Base.term",
"FStar.Set.subset",
"Pulse.Syntax.Base.var",
"Pulse.Syntax.Naming.freevars",
"Pulse.Syntax.Base.comp_post",
"Pulse.Typing.fresh_wrt",
"Pulse.Typing.vprop_equiv",
"Pulse.Typing.Env.push_binding",
"Pulse.Syntax.Base.ppname_default",
"Pulse.Syntax.Base.comp_res",
"Pulse.Syntax.Naming.open_term",
"Pulse.Syntax.Base.eq_tm",
"Prims.bool",
"Pulse.Typing.universe_of",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__res",
"Pulse.Syntax.Base.st_comp_of_comp",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__u",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__pre",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__post",
"Pulse.Checker.Base.t_equiv",
"Pulse.Typing.st_equiv",
"Pulse.Typing.ST_VPropEquiv",
"FStar.Reflection.Typing.Rel_refl",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Pure.elab_term",
"FStar.Reflection.Typing.R_Eq",
"Pulse.Typing.VE_Refl",
"Pulse.Syntax.Base.comp_pre",
"Pulse.Checker.Base.comp_st_with_post",
"FStar.Pervasives.dtuple4",
"Pulse.Typing.Metatheory.Base.st_comp_typing_inversion",
"FStar.Pervasives.Native.fst",
"Pulse.Typing.st_comp_typing",
"Pulse.Typing.Metatheory.Base.iname_typing",
"Pulse.Typing.Metatheory.Base.comp_typing_inversion",
"Pulse.Typing.Metatheory.Base.st_typing_correctness",
"Prims.eq2",
"Pulse.Syntax.Base.st_comp",
"Pulse.Syntax.Base.Mkst_comp"
] | [] | false | false | false | false | false | let st_equiv_post
(#g: env)
(#t: st_term)
(#c: comp_st)
(d: st_typing g t c)
(post: term{(freevars post) `Set.subset` (freevars (comp_post c))})
(veq:
(x: var{fresh_wrt x g (freevars (comp_post c))}
-> vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post) =
| if eq_tm post (comp_post c)
then d
else
let c' = comp_st_with_post c post in
let (| u_of , pre_typing , x , post_typing |) =
let open Metatheory in
st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))
in
let veq = veq x in
let st_equiv:st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq
in
t_equiv d st_equiv | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Psrld | val eval_Psrld (amt: int) (dst: quad32) : option quad32 | val eval_Psrld (amt: int) (dst: quad32) : option quad32 | let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 95,
"end_line": 140,
"start_col": 0,
"start_line": 139
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | amt: Prims.int -> dst: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Prims.int",
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_sse2",
"Prims.op_AmpAmp",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Pervasives.Native.Some",
"Vale.Def.Words.Four_s.four_map",
"Vale.Def.Words_s.natN",
"Vale.Def.Words_s.pow2_32",
"Vale.Def.Types_s.ishr",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Psrld (amt: int) (dst: quad32) : option quad32 =
| check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Sbb64 | val eval_Sbb64 (old_carry: bool) (dst src: nat64) : option (bool & nat64) | val eval_Sbb64 (old_carry: bool) (dst src: nat64) : option (bool & nat64) | let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 33,
"end_line": 49,
"start_col": 0,
"start_line": 47
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | old_carry: Prims.bool -> dst: Vale.X64.Machine_s.nat64 -> src: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option (Prims.bool * Vale.X64.Machine_s.nat64) | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"Vale.X64.Machine_s.nat64",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_LessThan",
"Prims.op_Modulus",
"Vale.X64.Machine_s.pow2_64",
"Prims.int",
"Prims.op_Subtraction",
"Prims.op_Addition",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Sbb64 (old_carry: bool) (dst src: nat64) : option (bool & nat64) =
| let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) | false |
Vale.AES.X64.GCMdecryptOpt.fst | Vale.AES.X64.GCMdecryptOpt.va_wp_Gcm_extra_bytes | val va_wp_Gcm_extra_bytes
(alg: algorithm)
(inout_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(total_bytes: nat)
(old_hash: quad32)
(completed_quads: (seq quad32))
(h_LE: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Gcm_extra_bytes
(alg: algorithm)
(inout_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(total_bytes: nat)
(old_hash: quad32)
(completed_quads: (seq quad32))
(h_LE: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\
Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b
inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax
va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\ (forall
(va_x_mem:vale_heap) (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm10:quad32) (va_x_heap5:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 5
va_x_heap5 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7
(va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRcx va_x_rcx (va_upd_mem va_x_mem va_s0)))))))))))))) in va_get_ok
va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 97,
"end_line": 234,
"start_col": 0,
"start_line": 195
} | module Vale.AES.X64.GCMdecryptOpt
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GCM
open Vale.AES.GHash_s
open Vale.AES.GHash
open Vale.AES.GCM_s
open Vale.AES.X64.AES
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.Poly1305.Math
open Vale.AES.GCM_helpers
open Vale.AES.X64.GHash
open Vale.AES.X64.GCTR
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsStack
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.X64.GF128_Mul
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2.Bits_s
open Vale.AES.X64.AESopt
open Vale.AES.X64.AESGCM
open Vale.AES.X64.AESopt2
open Vale.Lib.Meta
open Vale.AES.X64.GCMencryptOpt
open Vale.AES.OptPublic
open Vale.Lib.Basic
#reset-options "--z3rlimit 20 --max_ifuel 0"
//-- Gcm_extra_bytes
val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_extra_bytes alg =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0)
(va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor
(va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_CNil ()))))))))))
val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_extra_bytes alg =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and
(va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat)
(old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit
(va_code_Gcm_extra_bytes alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range
1 1)) = 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRax) 0 Secret inout_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let
(hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s)
inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key
round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax)
(va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (()))))))))))))))
val va_lemma_Gcm_extra_bytes : va_b0:va_code -> va_s0:va_state -> alg:algorithm ->
inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) ->
h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_extra_bytes alg) va_s0 /\ va_get_ok va_s0 /\ (let
(len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b
inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b
len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM
(va_update_mem va_sM va_s0))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_extra_bytes va_b0 va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes
old_hash completed_quads h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_extra_bytes va_mods alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_extra_bytes alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 121 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (len:(va_int_range 1 1)) = 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 177 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 181 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE old_hash input_quads)))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Lib.Basic.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.GHash.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESopt.fsti.checked",
"Vale.AES.X64.AESGCM.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.GCM.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GCMdecryptOpt.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Lib.Basic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
alg: Vale.AES.AES_common_s.algorithm ->
inout_b: Vale.X64.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
total_bytes: Prims.nat ->
old_hash: Vale.X64.Decls.quad32 ->
completed_quads: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
h_LE: Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Prims.nat",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.sse_enabled",
"Vale.X64.Decls.buffers_disjoint128",
"Vale.X64.Decls.validDstAddrs128",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Prims.op_LessThanOrEqual",
"Prims.op_GreaterThanOrEqual",
"Vale.X64.Decls.buffer_length",
"Vale.X64.Memory.vuint128",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_get_xmm",
"Vale.Def.Words_s.Mkfour",
"Vale.AES.X64.GCMencryptOpt.aes_reqs",
"Vale.X64.Machine_s.rR8",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled",
"Vale.AES.GHash.hkeys_reqs_priv",
"Vale.X64.Decls.s128",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Vale.X64.Decls.validSrcAddrs128",
"Prims.op_Subtraction",
"Vale.X64.Machine_s.rR9",
"Vale.Def.Types_s.quad32",
"Vale.AES.GHash.ghash_incremental0",
"FStar.Seq.Base.length",
"Prims.op_Division",
"Prims.op_LessThan",
"Prims.op_Addition",
"Prims.op_Multiply",
"Vale.X64.Machine_s.rR10",
"Prims.op_Modulus",
"Prims.l_not",
"Vale.AES.GCM_helpers.bytes_to_quad_size",
"Vale.X64.Decls.va_int_range",
"Prims.l_Forall",
"Vale.X64.InsBasic.vale_heap",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Vale.X64.Decls.modifies_buffer128",
"Vale.AES.GCTR.gctr_partial",
"Prims.op_GreaterThan",
"Vale.AES.GHash.ghash_incremental",
"Vale.Def.Types_s.le_bytes_to_seq_quad32",
"Vale.Def.Words_s.nat8",
"Vale.AES.GCTR_s.pad_to_128_bits",
"FStar.Seq.Base.slice",
"Vale.Def.Types_s.nat8",
"Vale.Def.Types_s.le_seq_quad32_to_bytes",
"FStar.Seq.Base.append",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_mem_heaplet",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Decls.va_upd_mem"
] | [] | false | false | false | true | true | let va_wp_Gcm_extra_bytes
(alg: algorithm)
(inout_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(total_bytes: nat)
(old_hash: quad32)
(completed_quads: (seq quad32))
(h_LE: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(let len:(va_int_range 1 1) = 1 in
sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0)
(va_get_reg64 rRax va_s0)
inout_b
len
(va_get_mem_layout va_s0)
Secret /\ len == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b /\
va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
aes_reqs alg
key
round_keys
keys_b
(va_get_reg64 rR8 va_s0)
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rR9 va_s0 - 32)
hkeys_b
8
(va_get_mem_layout va_s0)
Secret /\
va_get_xmm 8 va_s0 ==
Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental0 h_LE
old_hash
completed_quads) /\
FStar.Seq.Base.length #quad32 completed_quads == total_bytes `op_Division` 16 /\
total_bytes < 16 `op_Multiply` (FStar.Seq.Base.length #quad32 completed_quads) + 16 /\
va_get_reg64 rR10 va_s0 == total_bytes `op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\
(0 < total_bytes /\
total_bytes < 16 `op_Multiply` (Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes)) /\
16 `op_Multiply` (Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\
(forall (va_x_mem: vale_heap) (va_x_rcx: nat64) (va_x_r11: nat64) (va_x_xmm0: quad32)
(va_x_xmm1: quad32) (va_x_xmm2: quad32) (va_x_xmm3: quad32) (va_x_xmm4: quad32)
(va_x_xmm5: quad32) (va_x_xmm6: quad32) (va_x_xmm7: quad32) (va_x_xmm8: quad32)
(va_x_xmm10: quad32) (va_x_heap5: vale_heap) (va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_mem_heaplet 5
va_x_heap5
(va_upd_xmm 10
va_x_xmm10
(va_upd_xmm 8
va_x_xmm8
(va_upd_xmm 7
va_x_xmm7
(va_upd_xmm 6
va_x_xmm6
(va_upd_xmm 5
va_x_xmm5
(va_upd_xmm 4
va_x_xmm4
(va_upd_xmm 3
va_x_xmm3
(va_upd_xmm 2
va_x_xmm2
(va_upd_xmm 1
va_x_xmm1
(va_upd_xmm 0
va_x_xmm0
(va_upd_reg64 rR11
va_x_r11
(va_upd_reg64 rRcx
va_x_rcx
(va_upd_mem va_x_mem va_s0))))))))))))
))
in
va_get_ok va_sM /\
(let len:(va_int_range 1 1) = 1 in
Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0)
(va_get_mem_heaplet 5 va_sM) /\
Vale.AES.GCTR.gctr_partial alg
len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b)
key
(va_get_xmm 11 va_s0) /\
(let raw_quads =
FStar.Seq.Base.append #quad32
completed_quads
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)
in
let input_bytes =
FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads)
0
total_bytes
in
let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in
let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in
l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) ==
Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==>
va_k va_sM (()))) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Palignr | val eval_Palignr (amount: nat8) (src1 src2: quad32) : option quad32 | val eval_Palignr (amount: nat8) (src1 src2: quad32) : option quad32 | let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 49,
"end_line": 161,
"start_col": 0,
"start_line": 160
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | amount: Vale.Def.Types_s.nat8 -> src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.Def.Types_s.nat8",
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_ssse3",
"Vale.X64.Instructions_s.eval_Palignr_raw",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Palignr (amount: nat8) (src1 src2: quad32) : option quad32 =
| check_ssse3 (eval_Palignr_raw amount src1 src2) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Shufpd_raw | val eval_Shufpd_raw (permutation: int) (src1 src2: quad32) : option quad32 | val eval_Shufpd_raw (permutation: int) (src1 src2: quad32) : option quad32 | let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 177,
"start_col": 0,
"start_line": 170
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | permutation: Prims.int -> src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Prims.int",
"Vale.X64.Machine_s.quad32",
"Prims.op_AmpAmp",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"FStar.Pervasives.Native.Some",
"Vale.Def.Words_s.Mkfour",
"Vale.Def.Types_s.nat32",
"Prims.op_Equality",
"Prims.op_Modulus",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Prims.bool",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Prims.op_Division",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Shufpd_raw (permutation: int) (src1 src2: quad32) : option quad32 =
| if 0 <= permutation && permutation < 4
then
Some
(Mkfour (if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None | false |
Vale.AES.X64.GCMdecryptOpt.fst | Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_blocks | val va_code_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_code | val va_code_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_code | let va_code_Gcm_blocks alg offset =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx))
(va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rR9) (va_op_opr64_reg64 rR9) (va_const_opr64
32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRbx) (va_op_reg_opr64_reg64 rRsp)
(offset + 0)) (va_CCons (va_code_Gcm_blocks_auth ()) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rRdi) (va_op_reg_opr64_reg64 rRsp) (offset + 8)) (va_CCons
(va_code_Load64_stack (va_op_dst_opr64_reg64 rRsi) (va_op_reg_opr64_reg64 rRsp) (offset + 16))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp)
(offset + 24)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR13))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 2) (va_op_xmm_xmm 1) (va_op_reg_opr64_reg64
rR8) 0 Public) (va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet 3)
(va_op_reg_opr64_reg64 rRbp) (va_op_xmm_xmm 1) 0 Secret) (va_CCons (va_code_Load_one_lsb
(va_op_xmm_xmm 10)) (va_CCons (va_code_VPaddd (va_op_xmm_xmm 1) (va_op_xmm_xmm 1)
(va_op_xmm_xmm 10)) (va_CCons (va_code_AES_GCM_decrypt_6mult alg) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64
rRbp) 32 Secret) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR8) (va_op_opr64_reg64 rRcx))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp)
(offset + 32)) (va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRsp) (offset + 40)) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rRdx) (va_op_reg_opr64_reg64 rRsp) (offset + 48)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rR14) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_InitPshufbMask (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rR12)) (va_CCons
(va_code_Pshufb (va_op_xmm_xmm 11) (va_op_xmm_xmm 9)) (va_CCons (va_code_Gcm_blocks128 alg)
(va_CCons (va_code_Stack_lemma ()) (va_CCons (va_code_Add64 (va_op_dst_opr64_reg64 rR14)
(va_opr_code_Stack (va_op_reg64_reg64 rRsp) (offset + 24) Public)) (va_CCons (va_code_IMul64
(va_op_dst_opr64_reg64 rR14) (va_const_opr64 16)) (va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64 rR13) (va_op_reg_opr64_reg64 rRsp) (offset + 64)) (va_CCons (va_IfElse
(va_cmp_gt (va_op_cmp_reg64 rR13) (va_op_cmp_reg64 rR14)) (va_Block (va_CCons
(va_code_Load64_stack (va_op_dst_opr64_reg64 rRax) (va_op_reg_opr64_reg64 rRsp) (offset + 56))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR10) (va_op_opr64_reg64 rR13)) (va_CCons
(va_code_And64 (va_op_dst_opr64_reg64 rR10) (va_const_opr64 15)) (va_CCons
(va_code_Gcm_extra_bytes alg) (va_CCons (va_Block (va_CNil ())) (va_CNil ()))))))) (va_Block
(va_CNil ()))) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR11) (va_op_opr64_reg64 rR15))
(va_CCons (va_code_Gcm_make_length_quad ()) (va_CCons (va_code_Ghash_register ()) (va_CCons
(va_code_Load128_buffer (va_op_heaplet_mem_heaplet 3) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRbp) 0 Secret) (va_CCons (va_code_Gctr_register alg) (va_CCons (va_Block (va_CNil ()))
(va_CNil ())))))))))))))))))))))))))))))))))))) | {
"file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 51,
"end_line": 536,
"start_col": 0,
"start_line": 499
} | module Vale.AES.X64.GCMdecryptOpt
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GCM
open Vale.AES.GHash_s
open Vale.AES.GHash
open Vale.AES.GCM_s
open Vale.AES.X64.AES
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.Poly1305.Math
open Vale.AES.GCM_helpers
open Vale.AES.X64.GHash
open Vale.AES.X64.GCTR
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsStack
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.X64.GF128_Mul
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2.Bits_s
open Vale.AES.X64.AESopt
open Vale.AES.X64.AESGCM
open Vale.AES.X64.AESopt2
open Vale.Lib.Meta
open Vale.AES.X64.GCMencryptOpt
open Vale.AES.OptPublic
open Vale.Lib.Basic
#reset-options "--z3rlimit 20 --max_ifuel 0"
//-- Gcm_extra_bytes
val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_extra_bytes alg =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0)
(va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor
(va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_CNil ()))))))))))
val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_extra_bytes alg =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and
(va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat)
(old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit
(va_code_Gcm_extra_bytes alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range
1 1)) = 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRax) 0 Secret inout_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let
(hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s)
inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key
round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax)
(va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (()))))))))))))))
val va_lemma_Gcm_extra_bytes : va_b0:va_code -> va_s0:va_state -> alg:algorithm ->
inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) ->
h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_extra_bytes alg) va_s0 /\ va_get_ok va_s0 /\ (let
(len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b
inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b
len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM
(va_update_mem va_sM va_s0))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_extra_bytes va_b0 va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes
old_hash completed_quads h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_extra_bytes va_mods alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_extra_bytes alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 121 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (len:(va_int_range 1 1)) = 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 177 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 181 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE old_hash input_quads)))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\
Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b
inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax
va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\ (forall
(va_x_mem:vale_heap) (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm10:quad32) (va_x_heap5:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 5
va_x_heap5 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7
(va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRcx va_x_rcx (va_upd_mem va_x_mem va_s0)))))))))))))) in va_get_ok
va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==> va_k va_sM (())))
val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat ->
old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags;
va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_extra_bytes (va_code_Gcm_extra_bytes alg) va_s0 alg inout_b key
round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10
va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_extra_bytes alg)) =
(va_QProc (va_code_Gcm_extra_bytes alg) ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem])
(va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE) (va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE))
//--
//-- Gcm_blocks128
val va_code_Gcm_blocks128 : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks128 alg =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_CCons
(va_code_Ghash_buffer ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi)
(va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdx)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Gctr_blocks128 alg) (va_CNil ())))))))))
val va_codegen_success_Gcm_blocks128 : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks128 alg =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Ghash_buffer ()) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Gctr_blocks128 alg) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks128 (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128)
(key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32)
: (va_quickCode unit (va_code_Gcm_blocks128 alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 274 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 275 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 277 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_buffer hkeys_b in_b h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_old_s))) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gctr_blocks128 alg in_b out_b key round_keys keys_b) (va_QEmpty (()))))))))))
val va_lemma_Gcm_blocks128 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 ->
out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks128 alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 10 va_sM (va_update_xmm 11 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR11 va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks128 va_b0 va_s0 alg in_b out_b key round_keys keys_b hkeys_b h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks128 va_mods alg in_b out_b key round_keys keys_b hkeys_b h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks128 alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 210 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 255 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 261 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 262 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx
va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 265 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) out_b)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 267 column 131 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==>
FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64) (va_x_rdi:nat64) (va_x_r11:nat64)
(va_x_r10:nat64) (va_x_rdx:nat64) (va_x_r12:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm11:quad32) (va_x_xmm10:quad32)
(va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64
rR10 va_x_r10 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRbx
va_x_rbx (va_upd_mem va_x_mem va_s0))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) ==> va_k va_sM (())))
val va_wpProof_Gcm_blocks128 : alg:algorithm -> in_b:buffer128 -> out_b:buffer128 -> key:(seq
nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> h_LE:quad32 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b
h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_blocks128 alg) ([va_Mod_flags;
va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6;
va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0;
va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi;
va_Mod_reg64 rRbx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_blocks128 (va_code_Gcm_blocks128 alg) va_s0 alg in_b out_b key
round_keys keys_b hkeys_b h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 10
va_sM (va_update_xmm 11 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6
va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2
va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR12 va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR11 va_sM
(va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM (va_update_ok va_sM (va_update_mem
va_sM va_s0))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) : (va_quickCode
unit (va_code_Gcm_blocks128 alg)) =
(va_QProc (va_code_Gcm_blocks128 alg) ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10;
va_Mod_xmm 11; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm
3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64
rR10; va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_mem])
(va_wp_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE)
(va_wpProof_Gcm_blocks128 alg in_b out_b key round_keys keys_b hkeys_b h_LE))
//--
//-- Gcm_blocks
#push-options "--z3rlimit 1000"
val va_code_Gcm_blocks : alg:algorithm -> offset:int -> Tot va_code | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Lib.Basic.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.GHash.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESopt.fsti.checked",
"Vale.AES.X64.AESGCM.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.GCM.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GCMdecryptOpt.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Lib.Basic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 1000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | alg: Vale.AES.AES_common_s.algorithm -> offset: Prims.int -> Vale.X64.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Prims.int",
"Vale.X64.Decls.va_Block",
"Vale.X64.Decls.va_CCons",
"Vale.X64.InsBasic.va_code_Mov64",
"Vale.X64.Decls.va_op_dst_opr64_reg64",
"Vale.X64.Machine_s.rR13",
"Vale.X64.Decls.va_op_opr64_reg64",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.InsBasic.va_code_AddLea64",
"Vale.X64.Machine_s.rR9",
"Vale.X64.Decls.va_const_opr64",
"Vale.X64.InsStack.va_code_Load64_stack",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Decls.va_op_reg_opr64_reg64",
"Vale.X64.Machine_s.rRsp",
"Prims.op_Addition",
"Vale.AES.X64.GCMencryptOpt.va_code_Gcm_blocks_auth",
"Vale.X64.Machine_s.rRdi",
"Vale.X64.Machine_s.rRsi",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.InsVector.va_code_Mov128",
"Vale.X64.Decls.va_op_xmm_xmm",
"Vale.X64.InsVector.va_code_Load128_buffer",
"Vale.X64.Decls.va_op_heaplet_mem_heaplet",
"Vale.X64.Machine_s.rR8",
"Vale.Arch.HeapTypes_s.Public",
"Vale.X64.InsVector.va_code_Store128_buffer",
"Vale.X64.Machine_s.rRbp",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.AES.X64.AESopt.va_code_Load_one_lsb",
"Vale.X64.InsVector.va_code_VPaddd",
"Vale.AES.X64.AESGCM.va_code_AES_GCM_decrypt_6mult",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Machine_s.rR14",
"Vale.X64.InsVector.va_code_InitPshufbMask",
"Vale.X64.Machine_s.rR12",
"Vale.X64.InsVector.va_code_Pshufb",
"Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_blocks128",
"Vale.X64.InsStack.va_code_Stack_lemma",
"Vale.X64.InsBasic.va_code_Add64",
"Vale.X64.Decls.va_opr_code_Stack",
"Vale.X64.Decls.va_op_reg64_reg64",
"Vale.X64.InsBasic.va_code_IMul64",
"Vale.X64.Decls.va_IfElse",
"Vale.X64.Decls.va_cmp_gt",
"Vale.X64.Decls.va_op_cmp_reg64",
"Vale.X64.Machine_s.rR10",
"Vale.X64.InsBasic.va_code_And64",
"Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_extra_bytes",
"Vale.X64.Decls.va_CNil",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rR15",
"Vale.AES.X64.GCMencryptOpt.va_code_Gcm_make_length_quad",
"Vale.AES.X64.AESopt2.va_code_Ghash_register",
"Vale.AES.X64.GCMencryptOpt.va_code_Gctr_register",
"Vale.X64.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_Gcm_blocks alg offset =
| (va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR13) (va_op_opr64_reg64 rRcx))
(va_CCons (va_code_AddLea64 (va_op_dst_opr64_reg64 rR9)
(va_op_opr64_reg64 rR9)
(va_const_opr64 32))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRbx)
(va_op_reg_opr64_reg64 rRsp)
(offset + 0))
(va_CCons (va_code_Gcm_blocks_auth ())
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdi)
(va_op_reg_opr64_reg64 rRsp)
(offset + 8))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRsi)
(va_op_reg_opr64_reg64 rRsp)
(offset + 16))
(va_CCons (va_code_Load64_stack (va_op_dst_opr64_reg64 rRdx)
(va_op_reg_opr64_reg64 rRsp)
(offset + 24))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRcx)
(va_op_opr64_reg64 rR13))
(va_CCons (va_code_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 9))
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet
2)
(va_op_xmm_xmm 1)
(va_op_reg_opr64_reg64 rR8)
0
Public)
(va_CCons (va_code_Store128_buffer (va_op_heaplet_mem_heaplet
3)
(va_op_reg_opr64_reg64 rRbp)
(va_op_xmm_xmm 1)
0
Secret)
(va_CCons (va_code_Load_one_lsb (va_op_xmm_xmm 10))
(va_CCons (va_code_VPaddd (va_op_xmm_xmm 1)
(va_op_xmm_xmm 1)
(va_op_xmm_xmm 10))
(va_CCons (va_code_AES_GCM_decrypt_6mult alg
)
(va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet
3)
(va_op_xmm_xmm 11)
(va_op_reg_opr64_reg64 rRbp)
32
Secret)
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64
rR8)
(va_op_opr64_reg64 rRcx))
(va_CCons (va_code_Load64_stack (
va_op_dst_opr64_reg64 rRax
)
(va_op_reg_opr64_reg64 rRsp
)
(offset + 32))
(va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64
rRdi)
(va_op_reg_opr64_reg64
rRsp)
(offset + 40))
(va_CCons (va_code_Load64_stack
(va_op_dst_opr64_reg64
rRdx)
(va_op_reg_opr64_reg64
rRsp)
(offset + 48))
(va_CCons (va_code_Mov64
(va_op_dst_opr64_reg64
rR14)
(va_op_opr64_reg64
rRdx))
(va_CCons (va_code_InitPshufbMask
(va_op_xmm_xmm
9)
(va_op_reg_opr64_reg64
rR12
))
(va_CCons (va_code_Pshufb
(va_op_xmm_xmm
11
)
(va_op_xmm_xmm
9
))
(va_CCons
(va_code_Gcm_blocks128
alg
)
(va_CCons
(
va_code_Stack_lemma
()
)
(
va_CCons
(
va_code_Add64
(
va_op_dst_opr64_reg64
rR14
)
(
va_opr_code_Stack
(
va_op_reg64_reg64
rRsp
)
(
offset +
24
)
Public
)
)
(
va_CCons
(
va_code_IMul64
(
va_op_dst_opr64_reg64
rR14
)
(
va_const_opr64
16
)
)
(
va_CCons
(
va_code_Load64_stack
(
va_op_dst_opr64_reg64
rR13
)
(
va_op_reg_opr64_reg64
rRsp
)
(
offset +
64
)
)
(
va_CCons
(
va_IfElse
(
va_cmp_gt
(
va_op_cmp_reg64
rR13
)
(
va_op_cmp_reg64
rR14
)
)
(
va_Block
(
va_CCons
(
va_code_Load64_stack
(
va_op_dst_opr64_reg64
rRax
)
(
va_op_reg_opr64_reg64
rRsp
)
(
offset +
56
)
)
(
va_CCons
(
va_code_Mov64
(
va_op_dst_opr64_reg64
rR10
)
(
va_op_opr64_reg64
rR13
)
)
(
va_CCons
(
va_code_And64
(
va_op_dst_opr64_reg64
rR10
)
(
va_const_opr64
15
)
)
(
va_CCons
(
va_code_Gcm_extra_bytes
alg
)
(
va_CCons
(
va_Block
(
va_CNil
()
)
)
(
va_CNil
()
)
)
)
)
)
)
)
(
va_Block
(
va_CNil
()
)
)
)
(
va_CCons
(
va_code_Mov64
(
va_op_dst_opr64_reg64
rR11
)
(
va_op_opr64_reg64
rR15
)
)
(
va_CCons
(
va_code_Gcm_make_length_quad
()
)
(
va_CCons
(
va_code_Ghash_register
()
)
(
va_CCons
(
va_code_Load128_buffer
(
va_op_heaplet_mem_heaplet
3
)
(
va_op_xmm_xmm
0
)
(
va_op_reg_opr64_reg64
rRbp
)
0
Secret
)
(
va_CCons
(
va_code_Gctr_register
alg
)
(
va_CCons
(
va_Block
(
va_CNil
()
)
)
(
va_CNil
()
)
)
)
)
)
)
)
)
)
)
)
))
))))))))))))
))))))))))) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Shufpd | val eval_Shufpd (permutation: int) (src1 src2: quad32) : option quad32 | val eval_Shufpd (permutation: int) (src1 src2: quad32) : option quad32 | let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 52,
"end_line": 180,
"start_col": 0,
"start_line": 179
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | permutation: Prims.int -> src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Prims.int",
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_sse2",
"Vale.X64.Instructions_s.eval_Shufpd_raw",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Shufpd (permutation: int) (src1 src2: quad32) : option quad32 =
| check_sse2 (eval_Shufpd_raw permutation src1 src2) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_VPalignr | val eval_VPalignr (amount: nat8) (src1 src2: quad32) : option quad32 | val eval_VPalignr (amount: nat8) (src1 src2: quad32) : option quad32 | let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 166,
"start_col": 0,
"start_line": 165
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | amount: Vale.Def.Types_s.nat8 -> src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.Def.Types_s.nat8",
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_avx",
"Vale.X64.Instructions_s.eval_Palignr_raw",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_VPalignr (amount: nat8) (src1 src2: quad32) : option quad32 =
| check_avx (eval_Palignr_raw amount src1 src2) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_VShufpd | val eval_VShufpd (permutation: int) (src1 src2: quad32) : option quad32 | val eval_VShufpd (permutation: int) (src1 src2: quad32) : option quad32 | let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 51,
"end_line": 185,
"start_col": 0,
"start_line": 184
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | permutation: Prims.int -> src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Prims.int",
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_avx",
"Vale.X64.Instructions_s.eval_Shufpd_raw",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_VShufpd (permutation: int) (src1 src2: quad32) : option quad32 =
| check_avx (eval_Shufpd_raw permutation src1 src2) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_AddCarry64 | val eval_AddCarry64 (old_carry: bool) (dst src: nat64) : option (bool & nat64) | val eval_AddCarry64 (old_carry: bool) (dst src: nat64) : option (bool & nat64) | let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 34,
"start_col": 0,
"start_line": 32
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | old_carry: Prims.bool -> dst: Vale.X64.Machine_s.nat64 -> src: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option (Prims.bool * Vale.X64.Machine_s.nat64) | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"Vale.X64.Machine_s.nat64",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_GreaterThanOrEqual",
"Vale.X64.Machine_s.pow2_64",
"Prims.op_Modulus",
"Prims.int",
"Prims.op_Addition",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_AddCarry64 (old_carry: bool) (dst src: nat64) : option (bool & nat64) =
| let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64) | false |
Vale.AES.X64.GCMdecryptOpt.fst | Vale.AES.X64.GCMdecryptOpt.va_quick_Gcm_extra_bytes | val va_quick_Gcm_extra_bytes
(alg: algorithm)
(inout_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(total_bytes: nat)
(old_hash: quad32)
(completed_quads: (seq quad32))
(h_LE: quad32)
: (va_quickCode unit (va_code_Gcm_extra_bytes alg)) | val va_quick_Gcm_extra_bytes
(alg: algorithm)
(inout_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(total_bytes: nat)
(old_hash: quad32)
(completed_quads: (seq quad32))
(h_LE: quad32)
: (va_quickCode unit (va_code_Gcm_extra_bytes alg)) | let va_quick_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_extra_bytes alg)) =
(va_QProc (va_code_Gcm_extra_bytes alg) ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem])
(va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE) (va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE)) | {
"file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 274,
"start_col": 0,
"start_line": 266
} | module Vale.AES.X64.GCMdecryptOpt
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GCM
open Vale.AES.GHash_s
open Vale.AES.GHash
open Vale.AES.GCM_s
open Vale.AES.X64.AES
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.Poly1305.Math
open Vale.AES.GCM_helpers
open Vale.AES.X64.GHash
open Vale.AES.X64.GCTR
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsStack
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.X64.GF128_Mul
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2.Bits_s
open Vale.AES.X64.AESopt
open Vale.AES.X64.AESGCM
open Vale.AES.X64.AESopt2
open Vale.Lib.Meta
open Vale.AES.X64.GCMencryptOpt
open Vale.AES.OptPublic
open Vale.Lib.Basic
#reset-options "--z3rlimit 20 --max_ifuel 0"
//-- Gcm_extra_bytes
val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_extra_bytes alg =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0)
(va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor
(va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_CNil ()))))))))))
val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_extra_bytes alg =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and
(va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat)
(old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit
(va_code_Gcm_extra_bytes alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range
1 1)) = 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRax) 0 Secret inout_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let
(hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s)
inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key
round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax)
(va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (()))))))))))))))
val va_lemma_Gcm_extra_bytes : va_b0:va_code -> va_s0:va_state -> alg:algorithm ->
inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) ->
h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_extra_bytes alg) va_s0 /\ va_get_ok va_s0 /\ (let
(len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b
inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b
len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM
(va_update_mem va_sM va_s0))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_extra_bytes va_b0 va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes
old_hash completed_quads h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_extra_bytes va_mods alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_extra_bytes alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 121 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (len:(va_int_range 1 1)) = 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 177 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 181 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE old_hash input_quads)))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\
Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b
inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax
va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\ (forall
(va_x_mem:vale_heap) (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm10:quad32) (va_x_heap5:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 5
va_x_heap5 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7
(va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRcx va_x_rcx (va_upd_mem va_x_mem va_s0)))))))))))))) in va_get_ok
va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==> va_k va_sM (())))
val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat ->
old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags;
va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_extra_bytes (va_code_Gcm_extra_bytes alg) va_s0 alg inout_b key
round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10
va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Lib.Basic.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.GHash.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESopt.fsti.checked",
"Vale.AES.X64.AESGCM.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.GCM.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GCMdecryptOpt.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Lib.Basic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
alg: Vale.AES.AES_common_s.algorithm ->
inout_b: Vale.X64.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
total_bytes: Prims.nat ->
old_hash: Vale.X64.Decls.quad32 ->
completed_quads: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
h_LE: Vale.X64.Decls.quad32
-> Vale.X64.QuickCode.va_quickCode Prims.unit
(Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_extra_bytes alg) | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Prims.nat",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.AES.X64.GCMdecryptOpt.va_code_Gcm_extra_bytes",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_Mod_mem_heaplet",
"Vale.X64.QuickCode.va_Mod_xmm",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.QuickCode.va_Mod_mem",
"Prims.Nil",
"Vale.AES.X64.GCMdecryptOpt.va_wp_Gcm_extra_bytes",
"Vale.AES.X64.GCMdecryptOpt.va_wpProof_Gcm_extra_bytes",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Gcm_extra_bytes
(alg: algorithm)
(inout_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(total_bytes: nat)
(old_hash: quad32)
(completed_quads: (seq quad32))
(h_LE: quad32)
: (va_quickCode unit (va_code_Gcm_extra_bytes alg)) =
| (va_QProc (va_code_Gcm_extra_bytes alg)
([
va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6;
va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0;
va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem
])
(va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE)
(va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE)) | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.k_elab_equiv_continuation | val k_elab_equiv_continuation
(#g1: env)
(#g2: env{g2 `env_extends` g1})
(#ctxt #ctxt1 #ctxt2: term)
(k: continuation_elaborator g1 ctxt g2 ctxt1)
(d: vprop_equiv g2 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt g2 ctxt2 | val k_elab_equiv_continuation
(#g1: env)
(#g2: env{g2 `env_extends` g1})
(#ctxt #ctxt1 #ctxt2: term)
(k: continuation_elaborator g1 ctxt g2 ctxt1)
(d: vprop_equiv g2 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt g2 ctxt2 | let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term)
(k:continuation_elaborator g1 ctxt g2 ctxt1)
(d:vprop_equiv g2 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt g2 ctxt2 =
fun post_hint res ->
let (| st, c, st_d |) = res in
let st_d : st_typing g2 st c = st_d in
assert (comp_pre c == ctxt2);
let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in
k post_hint (| st, _, st_d' |) | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 34,
"end_line": 322,
"start_col": 0,
"start_line": 313
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r
let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res)
let comp_st_with_post (c:comp_st) (post:term)
: c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } =
match c with
| C_ST st -> C_ST { st with post }
| C_STGhost st -> C_STGhost { st with post }
| C_STAtomic i obs st -> C_STAtomic i obs {st with post}
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)
: option (st_equiv g c0 c2)
=
match d01 with
| ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 -> (
let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in
if x = y && eq_tm (comp_res c0) (comp_res c1)
then Some (
ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing
(RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)
(VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)
(VE_Trans _ _ _ _ eq_post_01 eq_post_12)
)
else None
)
| ST_TotEquiv g t1 t2 u typing eq ->
let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in
let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in
Some (ST_TotEquiv g t1 t3 u typing eq'')
let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c')
: st_typing g st c'
= match d with
| T_Equiv _ _ _ _ d0 eq' -> (
match st_equiv_trans eq' eq with
| None -> T_Equiv _ _ _ _ d eq
| Some eq'' -> T_Equiv _ _ _ _ d0 eq''
)
| _ -> T_Equiv _ _ _ _ d eq
let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { freevars post `Set.subset` freevars (comp_post c)})
(veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } ->
vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post)
= if eq_tm post (comp_post c) then d
else
let c' = comp_st_with_post c post in
let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let veq = veq x in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq
in
t_equiv d st_equiv
let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { comp_post c == tm_star post tm_emp})
: st_typing g t (comp_st_with_post c post)
= st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x))
let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t)
: Lemma
(requires
comp_post_matches_hint c post_hint /\
effect_annot_of_comp c == effect_annot_of_comp c' /\
comp_res c' == comp_res c /\
comp_u c' == comp_u c /\
comp_post c' == tm_star (comp_post c) tm_emp)
(ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\
comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c')
= ()
let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g p ctxt)
: tot_typing g p tm_vprop
= let _, bk = vprop_equiv_typing d in
bk ctxt_typing
let comp_with_pre (c:comp_st) (pre:term) =
match c with
| C_ST st -> C_ST { st with pre }
| C_STGhost st -> C_STGhost { st with pre }
| C_STAtomic i obs st -> C_STAtomic i obs {st with pre}
let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(pre:term)
(veq: vprop_equiv g (comp_pre c) pre)
: st_typing g t (comp_with_pre c pre)
= if eq_tm pre (comp_pre c) then d
else
let c' = comp_with_pre c pre in
let (| u_of, pre_typing, x, post_typing |) =
Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _)
in
t_equiv d st_equiv | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
k: Pulse.Checker.Base.continuation_elaborator g1 ctxt g2 ctxt1 ->
d: Pulse.Typing.vprop_equiv g2 ctxt1 ctxt2
-> Pulse.Checker.Base.continuation_elaborator g1 ctxt g2 ctxt2 | Prims.Tot | [
"total"
] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Typing.Env.env_extends",
"Pulse.Syntax.Base.term",
"Pulse.Checker.Base.continuation_elaborator",
"Pulse.Typing.vprop_equiv",
"Pulse.Typing.post_hint_opt",
"Pulse.Typing.Combinators.st_typing_in_ctxt",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp_st",
"Prims.l_and",
"Prims.eq2",
"Pulse.Syntax.Base.vprop",
"Pulse.Syntax.Base.comp_pre",
"Pulse.Typing.comp_post_matches_hint",
"Pulse.Typing.st_typing",
"FStar.Pervasives.Mkdtuple3",
"Pulse.Checker.Base.comp_with_pre",
"Pulse.Checker.Base.st_equiv_pre",
"Pulse.Typing.VE_Sym",
"Prims.unit",
"Prims._assert"
] | [] | false | false | false | false | false | let k_elab_equiv_continuation
(#g1: env)
(#g2: env{g2 `env_extends` g1})
(#ctxt #ctxt1 #ctxt2: term)
(k: continuation_elaborator g1 ctxt g2 ctxt1)
(d: vprop_equiv g2 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt g2 ctxt2 =
| fun post_hint res ->
let (| st , c , st_d |) = res in
let st_d:st_typing g2 st c = st_d in
assert (comp_pre c == ctxt2);
let st_d':st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in
k post_hint (| st, _, st_d' |) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.is_full_byte_reversal_mask | val is_full_byte_reversal_mask (q: quad32) : bool | val is_full_byte_reversal_mask (q: quad32) : bool | let is_full_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x04050607 &&
q.hi3 = 0x00010203 | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 20,
"end_line": 193,
"start_col": 0,
"start_line": 189
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation)
let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2)
val ins_VShufpd (permutation:int) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | q: Vale.X64.Machine_s.quad32 -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"Prims.int",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Prims.bool"
] | [] | false | false | false | true | false | let is_full_byte_reversal_mask (q: quad32) : bool =
| q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x04050607 && q.hi3 = 0x00010203 | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_AddLea64 | val eval_AddLea64 (src1 src2: nat64) : option nat64 | val eval_AddLea64 (src1 src2: nat64) : option nat64 | let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 83,
"end_line": 29,
"start_col": 0,
"start_line": 29
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | src1: Vale.X64.Machine_s.nat64 -> src2: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.nat64 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"FStar.Pervasives.Native.Some",
"Prims.op_Modulus",
"Prims.op_Addition",
"Vale.X64.Machine_s.pow2_64",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_AddLea64 (src1 src2: nat64) : option nat64 =
| Some ((src1 + src2) % pow2_64) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Adcx64_Adox64 | val eval_Adcx64_Adox64 (old_flag: bool) (dst src: nat64) : option (bool & nat64) | val eval_Adcx64_Adox64 (old_flag: bool) (dst src: nat64) : option (bool & nat64) | let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 68,
"end_line": 39,
"start_col": 0,
"start_line": 37
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | old_flag: Prims.bool -> dst: Vale.X64.Machine_s.nat64 -> src: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option (Prims.bool * Vale.X64.Machine_s.nat64) | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"Vale.X64.Machine_s.nat64",
"Vale.X64.CPU_Features_s.adx_enabled",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_GreaterThanOrEqual",
"Vale.X64.Machine_s.pow2_64",
"Prims.op_Modulus",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option",
"Prims.int",
"Prims.op_Addition"
] | [] | false | false | false | true | false | let eval_Adcx64_Adox64 (old_flag: bool) (dst src: nat64) : option (bool & nat64) =
| let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Mulx64 | val eval_Mulx64 (rdx src: nat64) : option (nat64 & nat64) | val eval_Mulx64 (rdx src: nat64) : option (nat64 & nat64) | let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 59,
"start_col": 0,
"start_line": 56
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | rdx: Vale.X64.Machine_s.nat64 -> src: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option (Vale.X64.Machine_s.nat64 * Vale.X64.Machine_s.nat64) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"Vale.X64.CPU_Features_s.bmi2_enabled",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option",
"FStar.UInt.uint_t",
"FStar.UInt.mul_mod",
"FStar.UInt.mul_div"
] | [] | false | false | false | true | false | let eval_Mulx64 (rdx src: nat64) : option (nat64 & nat64) =
| let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Sub64 | val eval_Sub64 (dst src: nat64) : option (bool & nat64) | val eval_Sub64 (dst src: nat64) : option (bool & nat64) | let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 57,
"end_line": 44,
"start_col": 0,
"start_line": 43
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Machine_s.nat64 -> src: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option (Prims.bool * Vale.X64.Machine_s.nat64) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.tuple2",
"Prims.bool",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_LessThan",
"Prims.op_Modulus",
"Vale.X64.Machine_s.pow2_64",
"Prims.int",
"Prims.op_Subtraction",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Sub64 (dst src: nat64) : option (bool & nat64) =
| let diff = dst - src in
Some (diff < 0, diff % pow2_64) | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.norm_st_typing_inverse | val norm_st_typing_inverse
(#g:env) (#e:st_term) (#t0:term)
(d:st_typing g e (C_Tot t0))
(#u:_)
(t1:term)
(d1:tot_typing g t1 (tm_type u))
(steps:list norm_step)
: T.Tac (option (st_typing g e (C_Tot t1))) | val norm_st_typing_inverse
(#g:env) (#e:st_term) (#t0:term)
(d:st_typing g e (C_Tot t0))
(#u:_)
(t1:term)
(d1:tot_typing g t1 (tm_type u))
(steps:list norm_step)
: T.Tac (option (st_typing g e (C_Tot t1))) | let norm_st_typing_inverse
(#g:env) (#e:st_term) (#t0:term)
(d:st_typing g e (C_Tot t0))
(#u:_)
(t1:term)
(d1:tot_typing g t1 (tm_type u))
(steps:list norm_step)
: T.Tac (option (st_typing g e (C_Tot t1)))
= let d1
: Ghost.erased (RT.tot_typing (elab_env g) (elab_term t1) (RT.tm_type u))
= Ghost.hide d1._0
in
let (| t1', t1'_typing, related_t1_t1' |) =
Pulse.RuntimeUtils.norm_well_typed_term d1 steps
in
match Pulse.Readback.readback_ty t1' with
| Some t1_p ->
if TermEq.term_eq (elab_term t0) t1'
then (
let t0_typing
: Ghost.erased (RT.tot_typing (elab_env g) (elab_term t0) (RT.tm_type u)) =
rt_equiv_typing #_ #_ #(elab_term t0) related_t1_t1' d1
in
let eq
: Ghost.erased (RT.equiv (elab_env g) (elab_term t0) (elab_term t1))
= Ghost.hide (RT.Rel_sym _ _ _ related_t1_t1')
in
let steq : st_equiv g (C_Tot t0) (C_Tot t1) =
ST_TotEquiv _ _ _ u (E (Ghost.reveal t0_typing)) eq
in
Some (T_Equiv _ _ _ _ d steq)
)
else None
| _ -> None | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 15,
"end_line": 861,
"start_col": 0,
"start_line": 828
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r
let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res)
let comp_st_with_post (c:comp_st) (post:term)
: c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } =
match c with
| C_ST st -> C_ST { st with post }
| C_STGhost st -> C_STGhost { st with post }
| C_STAtomic i obs st -> C_STAtomic i obs {st with post}
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)
: option (st_equiv g c0 c2)
=
match d01 with
| ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 -> (
let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in
if x = y && eq_tm (comp_res c0) (comp_res c1)
then Some (
ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing
(RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)
(VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)
(VE_Trans _ _ _ _ eq_post_01 eq_post_12)
)
else None
)
| ST_TotEquiv g t1 t2 u typing eq ->
let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in
let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in
Some (ST_TotEquiv g t1 t3 u typing eq'')
let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c')
: st_typing g st c'
= match d with
| T_Equiv _ _ _ _ d0 eq' -> (
match st_equiv_trans eq' eq with
| None -> T_Equiv _ _ _ _ d eq
| Some eq'' -> T_Equiv _ _ _ _ d0 eq''
)
| _ -> T_Equiv _ _ _ _ d eq
let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { freevars post `Set.subset` freevars (comp_post c)})
(veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } ->
vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post)
= if eq_tm post (comp_post c) then d
else
let c' = comp_st_with_post c post in
let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let veq = veq x in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq
in
t_equiv d st_equiv
let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { comp_post c == tm_star post tm_emp})
: st_typing g t (comp_st_with_post c post)
= st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x))
let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t)
: Lemma
(requires
comp_post_matches_hint c post_hint /\
effect_annot_of_comp c == effect_annot_of_comp c' /\
comp_res c' == comp_res c /\
comp_u c' == comp_u c /\
comp_post c' == tm_star (comp_post c) tm_emp)
(ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\
comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c')
= ()
let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g p ctxt)
: tot_typing g p tm_vprop
= let _, bk = vprop_equiv_typing d in
bk ctxt_typing
let comp_with_pre (c:comp_st) (pre:term) =
match c with
| C_ST st -> C_ST { st with pre }
| C_STGhost st -> C_STGhost { st with pre }
| C_STAtomic i obs st -> C_STAtomic i obs {st with pre}
let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(pre:term)
(veq: vprop_equiv g (comp_pre c) pre)
: st_typing g t (comp_with_pre c pre)
= if eq_tm pre (comp_pre c) then d
else
let c' = comp_with_pre c pre in
let (| u_of, pre_typing, x, post_typing |) =
Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _)
in
t_equiv d st_equiv
#push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0"
let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term)
(k:continuation_elaborator g1 ctxt g2 ctxt1)
(d:vprop_equiv g2 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt g2 ctxt2 =
fun post_hint res ->
let (| st, c, st_d |) = res in
let st_d : st_typing g2 st c = st_d in
assert (comp_pre c == ctxt2);
let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in
k post_hint (| st, _, st_d' |)
#pop-options
let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g ctxt p)
: tot_typing g p tm_vprop
= let fwd, _ = vprop_equiv_typing d in
fwd ctxt_typing
#push-options "--z3rlimit_factor 4 --ifuel 1 --fuel 0"
let k_elab_equiv_prefix
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt)
(d:vprop_equiv g1 ctxt1 ctxt2)
: continuation_elaborator g1 ctxt2 g2 ctxt =
fun post_hint res ->
let framing_token : frame_for_req_in_ctxt g1 ctxt2 ctxt1 =
let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in
(| tm_emp, emp_typing, d |)
in
let res = k post_hint res in
let (| st, c, st_d |) = res in
assert (comp_pre c == ctxt1);
(| _, _, st_equiv_pre st_d _ d |)
#pop-options
let k_elab_equiv
(#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term)
(k:continuation_elaborator g1 ctxt1 g2 ctxt2)
(d1:vprop_equiv g1 ctxt1 ctxt1')
(d2:vprop_equiv g2 ctxt2 ctxt2')
: continuation_elaborator g1 ctxt1' g2 ctxt2' =
let k : continuation_elaborator g1 ctxt1 g2 ctxt2' =
k_elab_equiv_continuation k d2 in
let k : continuation_elaborator g1 ctxt1' g2 ctxt2' =
k_elab_equiv_prefix k d1 in
k
#push-options "--query_stats --fuel 2 --ifuel 2 --split_queries no --z3rlimit_factor 20"
open Pulse.PP
let continuation_elaborator_with_bind (#g:env) (ctxt:term)
(#c1:comp{stateful_comp c1})
(#e1:st_term)
(e1_typing:st_typing g e1 c1)
(ctxt_pre1_typing:tot_typing g (tm_star ctxt (comp_pre c1)) tm_vprop)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g
(tm_star ctxt (comp_pre c1))
(push_binding g (snd x) (fst x) (comp_res c1))
(tm_star (open_term (comp_post c1) (snd x)) ctxt)) =
let pre1 = comp_pre c1 in
let res1 = comp_res c1 in
let post1 = comp_post c1 in
let ctxt_typing = star_typing_inversion_l ctxt_pre1_typing in
// let p_prop = Metatheory.pure_typing_inversion pure_typing in
let v_eq = VE_Comm g ctxt pre1 in
let framing_token : frame_for_req_in_ctxt g (tm_star ctxt pre1) pre1 =
(| ctxt, ctxt_typing, VE_Comm g pre1 ctxt |)
in
let (| c1, e1_typing |) =
apply_frame ctxt_pre1_typing e1_typing framing_token in
let (| u_of_1, pre_typing, _, _ |) =
Metatheory.(st_comp_typing_inversion (fst <| comp_typing_inversion (st_typing_correctness e1_typing))) in
let b = res1 in
let ppname, x = x in
let g' = push_binding g x ppname b in
let post1_opened = open_term_nv post1 (v_as_nv x) in
let k : continuation_elaborator g (tm_star ctxt pre1) g' (tm_star post1_opened ctxt) =
fun post_hint res ->
let (| e2, c2, e2_typing |) = res in
assert (comp_post_matches_hint c2 post_hint);
let e2_typing : st_typing g' e2 c2 = e2_typing in
let e2_closed = close_st_term e2 x in
assume (open_st_term e2_closed x == e2);
assert (comp_pre c1 == (tm_star ctxt pre1));
assert (comp_post c1 == tm_star post1 ctxt);
assert (comp_pre c2 == tm_star post1_opened ctxt);
assert (open_term (comp_post c1) x == tm_star post1_opened (open_term ctxt x));
// ctxt is well-typed, hence ln
assume (open_term ctxt x == ctxt);
assert (open_term (comp_post c1) x == comp_pre c2);
// we closed e2 with x
assume (~ (x `Set.mem` freevars_st e2_closed));
if x `Set.mem` freevars (comp_post c2)
then fail g' None "Impossible: freevar clash when constructing continuation elaborator for bind, please file a bug-report"
else (
let t_typing, post_typing =
Pulse.Typing.Combinators.bind_res_and_post_typing g c2 x post_hint in
let g = push_context g "mk_bind" e1.range in
// info_doc g None
// [prefix 4 1 (doc_of_string "mk_bind e1 = ") (doc_of_string (Pulse.Syntax.Printer.st_term_to_string e1));
// prefix 4 1 (doc_of_string "mk_bind c1 = ") (pp #comp c1);
// prefix 4 1 (doc_of_string "mk_bind e2 = ") (doc_of_string (Pulse.Syntax.Printer.st_term_to_string e2));
// prefix 4 1 (doc_of_string "mk_bind c2 = ") (pp #comp c2)]
// ;
let (| e, c, e_typing |) =
Pulse.Typing.Combinators.mk_bind
g (tm_star ctxt pre1)
e1 e2_closed c1 c2 (ppname, x) e1_typing
u_of_1
e2_typing
t_typing
post_typing
(Some? post_hint)
in
(| e, c, e_typing |)
)
in
k
#pop-options
module LN = Pulse.Typing.LN
#push-options "--z3rlimit_factor 4 --fuel 1 --ifuel 1"
let st_comp_typing_with_post_hint
(#g:env) (#ctxt:_)
(ctxt_typing:tot_typing g ctxt tm_vprop)
(post_hint:post_hint_opt g { Some? post_hint })
(c:comp_st { comp_pre c == ctxt /\ comp_post_matches_hint c post_hint })
: st_comp_typing g (st_comp_of_comp c)
= let st = st_comp_of_comp c in
let Some ph = post_hint in
let post_typing_src
: tot_typing (push_binding ph.g ph.x ppname_default ph.ret_ty)
(open_term ph.post ph.x) tm_vprop
= ph.post_typing_src
in
let x = fresh g in
assume (fresh_wrt x g (freevars ph.post));
assume (None? (lookup g ph.x));
let post_typing_src
: tot_typing (push_binding ph.g x ppname_default ph.ret_ty)
(open_term ph.post x) tm_vprop
= if x = ph.x
then post_typing_src
else
let open Pulse.Typing.Metatheory.Base in
let tt :
tot_typing
(push_binding ph.g x ppname_default ph.ret_ty)
(subst_term (open_term ph.post ph.x) (renaming ph.x x))
(subst_term tm_vprop (renaming ph.x x)) =
tot_typing_renaming1 ph.g ph.x ph.ret_ty (open_term ph.post ph.x) tm_vprop post_typing_src x
in
assert (subst_term tm_vprop (renaming ph.x x) == tm_vprop);
assume (subst_term (open_term ph.post ph.x) (renaming ph.x x) ==
open_term ph.post x);
tt
in
let post_typing_src
: tot_typing (push_binding g x ppname_default ph.ret_ty)
(open_term ph.post x) tm_vprop
= //weakening: TODO
RU.magic ()
in
let ty_typing : universe_of ph.g st.res st.u = ph.ty_typing in
let ty_typing : universe_of g st.res st.u =
Pulse.Typing.Metatheory.tot_typing_weakening_standard ph.g ty_typing g
in
assert (st.res == ph.ret_ty);
assert (st.post == ph.post);
STC g st x ty_typing ctxt_typing post_typing_src
let continuation_elaborator_with_bind_fn (#g:env) (#ctxt:term)
(ctxt_typing:tot_typing g ctxt tm_vprop)
(#e1:st_term)
(#c1:comp { C_Tot? c1 })
(b:binder{b.binder_ty == comp_res c1})
(e1_typing:st_typing g e1 c1)
(x:nvar { None? (lookup g (snd x)) })
: T.Tac (continuation_elaborator
g ctxt
(push_binding g (snd x) ppname_default (comp_res c1)) ctxt)
= let t1 = comp_res c1 in
assert ((push_binding g (snd x) (fst x) t1) `env_extends` g);
fun post_hint (| e2, c2, d2 |) ->
if None? post_hint then T.fail "bind_fn: expects the post_hint to be set";
let ppname, x = x in
let e2_closed = close_st_term e2 x in
assume (open_st_term (close_st_term e2 x) x == e2);
let e = wr c2 (Tm_Bind {binder=b; head=e1; body=e2_closed}) in
let (| u, c1_typing |) = Pulse.Typing.Metatheory.Base.st_typing_correctness_ctot e1_typing in
let c2_typing : comp_typing g c2 (universe_of_comp c2) =
match c2 with
| C_ST st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
let i_typing = CP.core_check_term g i T.E_Total tm_inames in
CT_STAtomic _ _ obs _ i_typing stc
| C_STGhost st ->
let stc = st_comp_typing_with_post_hint ctxt_typing post_hint c2 in
CT_STGhost _ _ stc
in
let d : st_typing g e c2 =
T_BindFn g e1 e2_closed c1 c2 b x e1_typing u c1_typing d2 c2_typing
in
(| e, c2, d |)
let rec check_equiv_emp (g:env) (vp:term)
: option (vprop_equiv g vp tm_emp)
= match vp.t with
| Tm_Emp -> Some (VE_Refl _ _)
| Tm_Star vp1 vp2 ->
(match check_equiv_emp g vp1, check_equiv_emp g vp2 with
| Some d1, Some d2 ->
let d3 : vprop_equiv g (tm_star vp1 vp2) (tm_star tm_emp tm_emp)
= VE_Ctxt _ _ _ _ _ d1 d2 in
let d4 : vprop_equiv g (tm_star tm_emp tm_emp) tm_emp =
VE_Unit _ _ in
Some (VE_Trans _ _ _ _ d3 d4)
| _, _ -> None)
| _ -> None
let emp_inames_included (g:env) (i:term) (_:tot_typing g i tm_inames)
: prop_validity g (tm_inames_subset tm_emp_inames i)
= RU.magic()
let return_in_ctxt (g:env) (y:var) (y_ppname:ppname) (u:universe) (ty:term) (ctxt:vprop)
(ty_typing:universe_of g ty u)
(post_hint0:post_hint_opt g { Some? post_hint0 /\ checker_res_matches_post_hint g post_hint0 y ty ctxt})
: Pure (st_typing_in_ctxt g ctxt post_hint0)
(requires lookup g y == Some ty)
(ensures fun _ -> True)
= let Some post_hint = post_hint0 in
let x = fresh g in
assume (~ (x `Set.mem` freevars post_hint.post));
let ctag =
match post_hint.effect_annot with
| EffectAnnotAtomic _ -> STT_Atomic
| EffectAnnotGhost -> STT_Ghost
| _ -> STT
in
let y_tm = tm_var {nm_index=y;nm_ppname=y_ppname} in
let d = T_Return g ctag false u ty y_tm post_hint.post x ty_typing
(RU.magic ()) // that null_var y is well typed at ty in g, we know since lookup g y == Some ty
(RU.magic ()) // typing of (open post x) in (g, x) ... post_hint is well-typed, so should get
in
let t = wtag (Some ctag) (Tm_Return {expected_type=tm_unknown;insert_eq=false;term=y_tm}) in
let c = comp_return ctag false u ty y_tm post_hint.post x in
let d : st_typing g t c = d in
assume (comp_u c == post_hint.u); // this u should follow from equality of t
match c, post_hint.effect_annot with
| C_STAtomic _ obs _, EffectAnnotAtomic { opens } ->
assert (comp_inames c == tm_emp_inames);
let pht = post_hint_typing g post_hint x in
let validity = emp_inames_included g opens pht.effect_annot_typing in
let d = T_Sub _ _ _ _ d (STS_AtomicInvs _ (st_comp_of_comp c) tm_emp_inames opens obs obs validity) in
(| _, _, d |)
| _ ->
(| _, _, d |)
let match_comp_res_with_post_hint (#g:env) (#t:st_term) (#c:comp_st)
(d:st_typing g t c)
(post_hint:post_hint_opt g)
: T.Tac (t':st_term &
c':comp_st &
st_typing g t' c') =
match post_hint with
| None -> (| t, c, d |)
| Some { ret_ty } ->
let cres = comp_res c in
if eq_tm cres ret_ty
then (| t, c, d |)
else match Pulse.Checker.Pure.check_equiv g cres ret_ty with
| None ->
fail g (Some t.range)
(Printf.sprintf "Could not prove equiv for computed type %s and expected type %s"
(P.term_to_string cres)
(P.term_to_string ret_ty))
| Some tok ->
let d_equiv
: RT.equiv _ (elab_term cres) (elab_term ret_ty) =
RT.Rel_eq_token _ _ _ (FStar.Squash.return_squash tok) in
let c' = with_st_comp c {(st_comp_of_comp c) with res = ret_ty } in
let (| cres_typing, cpre_typing, x, cpost_typing |) =
st_comp_typing_inversion (fst <| comp_typing_inversion (st_typing_correctness d)) in
let d_stequiv : st_equiv g c c' =
ST_VPropEquiv _ c c' _ cpre_typing cres_typing cpost_typing d_equiv (VE_Refl _ _) (VE_Refl _ _)
in
(| t, c', T_Equiv _ _ _ _ d d_stequiv |)
let apply_checker_result_k (#g:env) (#ctxt:vprop) (#post_hint:post_hint_for_env g)
(r:checker_result_t g ctxt (Some post_hint))
(res_ppname:ppname)
: T.Tac (st_typing_in_ctxt g ctxt (Some post_hint)) =
// TODO: FIXME add to checker result type?
let (| y, g1, (| u_ty, ty_y, d_ty_y |), (| pre', _ |), k |) = r in
let (| u_ty_y, d_ty_y |) = Pulse.Checker.Pure.check_universe g1 ty_y in
let d : st_typing_in_ctxt g1 pre' (Some post_hint) =
return_in_ctxt g1 y res_ppname u_ty_y ty_y pre' d_ty_y (Some post_hint) in
k (Some post_hint) d
#push-options "--z3rlimit_factor 4 --fuel 0 --ifuel 1 --query_stats"
let checker_result_for_st_typing (#g:env) (#ctxt:vprop) (#post_hint:post_hint_opt g)
(d:st_typing_in_ctxt g ctxt post_hint)
(ppname:ppname)
: T.Tac (checker_result_t g ctxt post_hint) =
let (| t, c, d |) = d in
let x = fresh g in
let g' = push_binding g x ppname (comp_res c) in
let ctxt' = open_term_nv (comp_post c) (ppname, x) in
let k
: continuation_elaborator
g (tm_star tm_emp (comp_pre c))
g' (tm_star ctxt' tm_emp) =
continuation_elaborator_with_bind tm_emp d (RU.magic ()) (ppname, x) in
let k
: continuation_elaborator g (comp_pre c) g' ctxt' =
k_elab_equiv k (RU.magic ()) (RU.magic ()) in
let _ : squash (checker_res_matches_post_hint g post_hint x (comp_res c) ctxt') =
match post_hint with
| None -> ()
| Some post_hint -> () in
assert (g' `env_extends` g);
let comp_res_typing, _, f =
Metatheory.(st_comp_typing_inversion_cofinite (fst <| comp_typing_inversion (st_typing_correctness d))) in
// RU.magic is the typing of comp_res in g'
// weaken comp_res_typing
assume (~ (x `Set.mem` freevars (comp_post c)));
let tt : universe_of _ _ _ = RU.magic () in
(| x, g', (| comp_u c, comp_res c, tt |), (| ctxt', f x |), k |)
#pop-options
module R = FStar.Reflection.V2
let readback_comp_res_as_comp (c:T.comp) : option comp =
match c with
| T.C_Total t -> (
match readback_comp t with
| None -> None
| Some c -> Some c
)
| _ -> None
let rec is_stateful_arrow (g:env) (c:option comp) (args:list T.argv) (out:list T.argv)
: T.Tac (option (list T.argv & T.argv))
= let open R in
match c with
| None -> None
| Some (C_ST _)
| Some (C_STGhost _)
| Some (C_STAtomic _ _ _) -> (
match args, out with
| [], hd::tl -> Some (List.rev tl, hd)
| _ -> None //leftover or not enough args
)
| Some (C_Tot c_res) -> (
if not (Tm_FStar? c_res.t)
then None
else (
let Tm_FStar c_res = c_res.t in
let ht = T.inspect c_res in
match ht with
| T.Tv_Arrow b c -> (
match args with
| [] -> ( //no more args; check that only implicits remain, ending in an stateful comp
let bs, c = T.collect_arr_ln_bs c_res in
if List.Tot.for_all (fun b -> R.Q_Implicit? (R.inspect_binder b).qual) bs
then is_stateful_arrow g (readback_comp_res_as_comp (R.inspect_comp c)) [] out
else None //too few args
)
| (arg, qual)::args' -> ( //check that this arg qual matches the binder and recurse accordingly
match b.qual, qual with
| T.Q_Meta _, T.Q_Implicit
| T.Q_Implicit, T.Q_Implicit
| T.Q_Explicit, T.Q_Explicit -> //consume this argument
is_stateful_arrow g (readback_comp_res_as_comp c) args' ((arg, qual)::out)
| T.Q_Meta _, T.Q_Explicit
| T.Q_Implicit, T.Q_Explicit ->
//don't consume this argument
is_stateful_arrow g (readback_comp_res_as_comp c) args out
| _ -> None //incompatible qualifiers; bail
)
)
| _ ->
let c_res' = RU.whnf_lax (elab_env g) c_res in
let ht = T.inspect c_res' in
if T.Tv_Arrow? ht
then (
assume (not_tv_unknown c_res');
let c_res' = tm_fstar c_res' (T.range_of_term c_res') in
is_stateful_arrow g (Some (C_Tot c_res')) args out
)
else None
)
)
module RU = Pulse.RuntimeUtils
let is_stateful_application (g:env) (e:term)
: T.Tac (option st_term)
= match e.t with
| Tm_FStar host_term -> (
let head, args = T.collect_app_ln host_term in
assume (not_tv_unknown head);
match RU.lax_check_term_with_unknown_universes (elab_env g) head with
| None -> None
| Some ht ->
assume (not_tv_unknown ht);
let head_t = tm_fstar ht (T.range_of_term ht) in
match is_stateful_arrow g (Some (C_Tot head_t)) args [] with
| None -> None
| Some (applied_args, (last_arg, aqual))->
let head = T.mk_app head applied_args in
assume (not_tv_unknown head);
let head = tm_fstar head (T.range_of_term head) in
assume (not_tv_unknown last_arg);
let last_arg = tm_fstar last_arg (T.range_of_term last_arg) in
let qual =
match aqual with
| T.Q_Implicit -> Some Implicit
| _ -> None
in
let st_app = Tm_STApp { head; arg=last_arg; arg_qual=qual} in
let st_app = { term = st_app; range=e.range; effect_tag=default_effect_hint } in
Some st_app
)
| _ -> None
let apply_conversion
(#g:env) (#e:term) (#eff:_) (#t0:term)
(d:typing g e eff t0)
(#t1:term)
(eq:Ghost.erased (RT.related (elab_env g) (elab_term t0) RT.R_Eq (elab_term t1)))
: typing g e eff t1
= let d : RT.typing (elab_env g) (elab_term e) (eff, (elab_term t0)) = d._0 in
let r : RT.related (elab_env g) (elab_term t0) RT.R_Eq (elab_term t1) = eq in
let r = RT.Rel_equiv _ _ _ RT.R_Sub r in
let s : RT.sub_comp (elab_env g) (eff, (elab_term t0)) (eff, elab_term t1) =
RT.Relc_typ _ _ _ _ _ r
in
E (RT.T_Sub _ _ _ _ d s)
let norm_typing
(g:env) (e:term) (eff:_) (t0:term)
(d:typing g e eff t0)
(steps:list norm_step)
: T.Tac (t':term & typing g e eff t')
= let t = elab_term t0 in
let u_t_typing : Ghost.erased (u:R.universe & RT.typing _ _ _) =
Pulse.Typing.Metatheory.Base.typing_correctness d._0
in
let (| t', t'_typing, related_t_t' |) =
Pulse.RuntimeUtils.norm_well_typed_term (dsnd u_t_typing) steps
in
match Pulse.Readback.readback_ty t' with
| None -> T.fail "Could not readback normalized type"
| Some t'' ->
let d : typing g e eff t'' = apply_conversion d related_t_t' in
(| t'', d |)
module TermEq = FStar.Reflection.V2.TermEq
let norm_typing_inverse
(g:env) (e:term) (eff:_) (t0:term)
(d:typing g e eff t0)
(t1:term)
(#u:_)
(d1:tot_typing g t1 (tm_type u))
(steps:list norm_step)
: T.Tac (option (typing g e eff t1))
= let (| t1', t1'_typing, related_t1_t1' |) =
let d1 = Ghost.hide d1._0 in
Pulse.RuntimeUtils.norm_well_typed_term d1 steps
in
match Pulse.Readback.readback_ty t1' with
| Some t1_p ->
if TermEq.term_eq (elab_term t0) t1'
then (
let related_t1'_t1 = Ghost.hide (RT.Rel_sym _ _ _ related_t1_t1') in
Some (apply_conversion d related_t1'_t1)
)
else None
| _ -> None | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Reflection.V2.TermEq",
"short_module": "TermEq"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.LN",
"short_module": "LN"
},
{
"abbrev": false,
"full_module": "Pulse.PP",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 4,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
d: Pulse.Typing.st_typing g e (Pulse.Syntax.Base.C_Tot t0) ->
t1: Pulse.Syntax.Base.term ->
d1: Pulse.Typing.tot_typing g t1 (Pulse.Syntax.Pure.tm_type u575) ->
steps: Prims.list FStar.Pervasives.norm_step
-> FStar.Tactics.Effect.Tac
(FStar.Pervasives.Native.option (Pulse.Typing.st_typing g e (Pulse.Syntax.Base.C_Tot t1))) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.term",
"Pulse.Typing.st_typing",
"Pulse.Syntax.Base.C_Tot",
"Pulse.Syntax.Base.universe",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Pure.tm_type",
"Prims.list",
"FStar.Pervasives.norm_step",
"FStar.Stubs.Reflection.Types.term",
"FStar.Ghost.erased",
"FStar.Reflection.Typing.typing",
"Pulse.Typing.elab_env",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.TypeChecker.Core.tot_or_ghost",
"FStar.Stubs.Reflection.Types.typ",
"FStar.Stubs.TypeChecker.Core.E_Total",
"FStar.Ghost.reveal",
"FStar.Ghost.hide",
"FStar.Reflection.Typing.tm_type",
"FStar.Reflection.Typing.related",
"Pulse.Elaborate.Pure.elab_term",
"FStar.Reflection.Typing.R_Eq",
"Pulse.Readback.readback_ty",
"Prims.eq2",
"FStar.Reflection.V2.TermEq.term_eq",
"FStar.Pervasives.Native.Some",
"Pulse.Typing.T_Equiv",
"Pulse.Typing.st_equiv",
"Pulse.Typing.ST_TotEquiv",
"Pulse.Typing.E",
"FStar.Reflection.Typing.tot_typing",
"FStar.Reflection.Typing.equiv",
"FStar.Reflection.Typing.Rel_sym",
"Pulse.Typing.Metatheory.Base.rt_equiv_typing",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.dtuple3",
"Pulse.RuntimeUtils.norm_well_typed_term",
"Pulse.Typing.__proj__E__item___0"
] | [] | false | true | false | false | false | let norm_st_typing_inverse
(#g: env)
(#e: st_term)
(#t0: term)
(d: st_typing g e (C_Tot t0))
(#u: _)
(t1: term)
(d1: tot_typing g t1 (tm_type u))
(steps: list norm_step)
: T.Tac (option (st_typing g e (C_Tot t1))) =
| let d1:Ghost.erased (RT.tot_typing (elab_env g) (elab_term t1) (RT.tm_type u)) = Ghost.hide d1._0 in
let (| t1' , t1'_typing , related_t1_t1' |) = Pulse.RuntimeUtils.norm_well_typed_term d1 steps in
match Pulse.Readback.readback_ty t1' with
| Some t1_p ->
if TermEq.term_eq (elab_term t0) t1'
then
(let t0_typing:Ghost.erased (RT.tot_typing (elab_env g) (elab_term t0) (RT.tm_type u)) =
rt_equiv_typing #_ #_ #(elab_term t0) related_t1_t1' d1
in
let eq:Ghost.erased (RT.equiv (elab_env g) (elab_term t0) (elab_term t1)) =
Ghost.hide (RT.Rel_sym _ _ _ related_t1_t1')
in
let steq:st_equiv g (C_Tot t0) (C_Tot t1) =
ST_TotEquiv _ _ _ u (E (Ghost.reveal t0_typing)) eq
in
Some (T_Equiv _ _ _ _ d steq))
else None
| _ -> None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_IMul64 | val eval_IMul64 (dst src: nat64) : option nat64 | val eval_IMul64 (dst src: nat64) : option nat64 | let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 39,
"end_line": 63,
"start_col": 0,
"start_line": 62
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Machine_s.nat64 -> src: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.nat64 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"FStar.Pervasives.Native.Some",
"FStar.UInt.mul_mod",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_IMul64 (dst src: nat64) : option nat64 =
| Some (FStar.UInt.mul_mod #64 dst src) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Pshufb | val eval_Pshufb (src1 src2: quad32) : option quad32 | val eval_Pshufb (src1 src2: quad32) : option quad32 | let eval_Pshufb (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Pshufb_raw src1 src2) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 92,
"end_line": 237,
"start_col": 0,
"start_line": 237
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation)
let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2)
val ins_VShufpd (permutation:int) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation)
let is_full_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x04050607 &&
q.hi3 = 0x00010203
let is_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x00010203 &&
q.lo1 = 0x04050607 &&
q.hi2 = 0x08090A0B &&
q.hi3 = 0x0C0D0E0F
let is_high_dup_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let is_lower_upper_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x04050607 &&
q.lo1 = 0x00010203 &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let eval_Pshufb_raw (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if is_full_byte_reversal_mask src2 then
Some (reverse_bytes_quad32 src1)
else if is_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3))
else if is_high_dup_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else if is_lower_upper_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else None | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_ssse3",
"Vale.X64.Instructions_s.eval_Pshufb_raw",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Pshufb (src1 src2: quad32) : option quad32 =
| check_ssse3 (eval_Pshufb_raw src1 src2) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.is_high_dup_reversal_mask | val is_high_dup_reversal_mask (q: quad32) : bool | val is_high_dup_reversal_mask (q: quad32) : bool | let is_high_dup_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 20,
"end_line": 205,
"start_col": 0,
"start_line": 201
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation)
let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2)
val ins_VShufpd (permutation:int) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation)
let is_full_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x04050607 &&
q.hi3 = 0x00010203
let is_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x00010203 &&
q.lo1 = 0x04050607 &&
q.hi2 = 0x08090A0B &&
q.hi3 = 0x0C0D0E0F | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | q: Vale.X64.Machine_s.quad32 -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"Prims.int",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Prims.bool"
] | [] | false | false | false | true | false | let is_high_dup_reversal_mask (q: quad32) : bool =
| q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Pshufb_raw | val eval_Pshufb_raw (src1 src2: quad32) : option quad32 | val eval_Pshufb_raw (src1 src2: quad32) : option quad32 | let eval_Pshufb_raw (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if is_full_byte_reversal_mask src2 then
Some (reverse_bytes_quad32 src1)
else if is_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3))
else if is_high_dup_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else if is_lower_upper_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 235,
"start_col": 0,
"start_line": 213
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation)
let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2)
val ins_VShufpd (permutation:int) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation)
let is_full_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x04050607 &&
q.hi3 = 0x00010203
let is_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x00010203 &&
q.lo1 = 0x04050607 &&
q.hi2 = 0x08090A0B &&
q.hi3 = 0x0C0D0E0F
let is_high_dup_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let is_lower_upper_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x04050607 &&
q.lo1 = 0x00010203 &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.is_full_byte_reversal_mask",
"FStar.Pervasives.Native.Some",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Prims.bool",
"Vale.X64.Instructions_s.is_byte_reversal_mask",
"Vale.Def.Words_s.Mkfour",
"Vale.Def.Types_s.nat32",
"Vale.Def.Types_s.reverse_bytes_nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.X64.Instructions_s.is_high_dup_reversal_mask",
"Vale.X64.Instructions_s.is_lower_upper_byte_reversal_mask",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Pshufb_raw (src1 src2: quad32) : option quad32 =
| if is_full_byte_reversal_mask src2
then Some (reverse_bytes_quad32 src1)
else
if is_byte_reversal_mask src2
then
Some
(Mkfour (reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3))
else
if is_high_dup_reversal_mask src2
then
Some
(Mkfour (reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else
if is_lower_upper_byte_reversal_mask src2
then
Some
(Mkfour (reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.is_lower_upper_byte_reversal_mask | val is_lower_upper_byte_reversal_mask (q: quad32) : bool | val is_lower_upper_byte_reversal_mask (q: quad32) : bool | let is_lower_upper_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x04050607 &&
q.lo1 = 0x00010203 &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 20,
"end_line": 211,
"start_col": 0,
"start_line": 207
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation)
let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2)
val ins_VShufpd (permutation:int) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation)
let is_full_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x04050607 &&
q.hi3 = 0x00010203
let is_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x00010203 &&
q.lo1 = 0x04050607 &&
q.hi2 = 0x08090A0B &&
q.hi3 = 0x0C0D0E0F
let is_high_dup_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | q: Vale.X64.Machine_s.quad32 -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"Prims.int",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Prims.bool"
] | [] | false | false | false | true | false | let is_lower_upper_byte_reversal_mask (q: quad32) : bool =
| q.lo0 = 0x04050607 && q.lo1 = 0x00010203 && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.is_byte_reversal_mask | val is_byte_reversal_mask (q: quad32) : bool | val is_byte_reversal_mask (q: quad32) : bool | let is_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x00010203 &&
q.lo1 = 0x04050607 &&
q.hi2 = 0x08090A0B &&
q.hi3 = 0x0C0D0E0F | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 20,
"end_line": 199,
"start_col": 0,
"start_line": 195
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation)
let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2)
val ins_VShufpd (permutation:int) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation)
let is_full_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x04050607 &&
q.hi3 = 0x00010203 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | q: Vale.X64.Machine_s.quad32 -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Prims.op_AmpAmp",
"Prims.op_Equality",
"Prims.int",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Prims.bool"
] | [] | false | false | false | true | false | let is_byte_reversal_mask (q: quad32) : bool =
| q.lo0 = 0x00010203 && q.lo1 = 0x04050607 && q.hi2 = 0x08090A0B && q.hi3 = 0x0C0D0E0F | false |
Vale.AES.X64.GCMdecryptOpt.fst | Vale.AES.X64.GCMdecryptOpt.va_wp_Gcm_blocks128 | val va_wp_Gcm_blocks128
(alg: algorithm)
(in_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(h_LE: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Gcm_blocks128
(alg: algorithm)
(in_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(h_LE: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Gcm_blocks128 (alg:algorithm) (in_b:buffer128) (out_b:buffer128) (key:(seq nat32))
(round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret) /\ (forall (va_x_mem:vale_heap) (va_x_rbx:nat64) (va_x_rdi:nat64) (va_x_r11:nat64)
(va_x_r10:nat64) (va_x_rdx:nat64) (va_x_r12:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm11:quad32) (va_x_xmm10:quad32)
(va_x_heap1:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_mem_heaplet 1 va_x_heap1 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 11 va_x_xmm11
(va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5
(va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1
(va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rRdx va_x_rdx (va_upd_reg64
rR10 va_x_r10 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRbx
va_x_rbx (va_upd_mem va_x_mem va_s0))))))))))))))))))) in va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.AES.X64.GCMdecryptOpt.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 450,
"start_col": 0,
"start_line": 406
} | module Vale.AES.X64.GCMdecryptOpt
open Vale.Def.Prop_s
open Vale.Def.Opaque_s
open FStar.Seq
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open Vale.Def.Types_s
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.AES.AES_s
open Vale.AES.GCTR_s
open Vale.AES.GCTR
open Vale.AES.GCM
open Vale.AES.GHash_s
open Vale.AES.GHash
open Vale.AES.GCM_s
open Vale.AES.X64.AES
open Vale.AES.GF128_s
open Vale.AES.GF128
open Vale.Poly1305.Math
open Vale.AES.GCM_helpers
open Vale.AES.X64.GHash
open Vale.AES.X64.GCTR
open Vale.X64.Machine_s
open Vale.X64.Memory
open Vale.X64.Stack_i
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.InsBasic
open Vale.X64.InsMem
open Vale.X64.InsVector
open Vale.X64.InsStack
open Vale.X64.InsAes
open Vale.X64.QuickCode
open Vale.X64.QuickCodes
open Vale.AES.X64.GF128_Mul
open Vale.X64.Stack
open Vale.X64.CPU_Features_s
open Vale.Math.Poly2.Bits_s
open Vale.AES.X64.AESopt
open Vale.AES.X64.AESGCM
open Vale.AES.X64.AESopt2
open Vale.Lib.Meta
open Vale.AES.X64.GCMencryptOpt
open Vale.AES.OptPublic
open Vale.Lib.Basic
#reset-options "--z3rlimit 20 --max_ifuel 0"
//-- Gcm_extra_bytes
val va_code_Gcm_extra_bytes : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_extra_bytes alg =
(va_Block (va_CCons (va_code_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_CCons (va_code_Mov128 (va_op_xmm_xmm 10)
(va_op_xmm_xmm 0)) (va_CCons (va_code_Ghash_extra_bytes ()) (va_CCons (va_code_Mov128
(va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_CCons (va_code_Pshufb (va_op_xmm_xmm 0)
(va_op_xmm_xmm 9)) (va_CCons (va_code_AESEncryptBlock alg) (va_CCons (va_code_Pxor
(va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_CCons (va_code_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_CNil ()))))))))))
val va_codegen_success_Gcm_extra_bytes : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_extra_bytes alg =
(va_pbool_and (va_codegen_success_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0)
(va_op_reg_opr64_reg64 rRax) 0 Secret) (va_pbool_and (va_codegen_success_Mov128 (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Ghash_extra_bytes ()) (va_pbool_and
(va_codegen_success_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_pbool_and
(va_codegen_success_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (va_pbool_and
(va_codegen_success_AESEncryptBlock alg) (va_pbool_and (va_codegen_success_Pxor (va_op_xmm_xmm
10) (va_op_xmm_xmm 0)) (va_pbool_and (va_codegen_success_Store128_buffer
(va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax) (va_op_xmm_xmm 10) 0 Secret)
(va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_extra_bytes (va_mods:va_mods_t) (alg:algorithm) (inout_b:buffer128) (key:(seq
nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat)
(old_hash:quad32) (completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit
(va_code_Gcm_extra_bytes alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let (len:(va_int_range
1 1)) = 1 in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 188 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Load128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_xmm_xmm 0) (va_op_reg_opr64_reg64
rRax) 0 Secret inout_b 0) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 189 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (fun (va_s:va_state) _ -> let
(hash_input:quad32) = va_get_xmm 0 va_s in va_QBind va_range1
"***** PRECONDITION NOT MET AT line 193 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_extra_bytes hkeys_b total_bytes old_hash h_LE completed_quads) (fun
(va_s:va_state) _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 194 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(FStar.Seq.Base.equal #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s)
inout_b) (FStar.Seq.Base.create #quad32 1 hash_input)) (let (snap:(FStar.Seq.Base.seq
Vale.X64.Decls.quad32)) = Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s) inout_b in va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 198 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov128 (va_op_xmm_xmm 0) (va_op_xmm_xmm 11)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 199 column 11 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pshufb (va_op_xmm_xmm 0) (va_op_xmm_xmm 9)) (fun (va_s:va_state) _ -> va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 200 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_AESEncryptBlock alg (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 11 va_s)) key
round_keys keys_b) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 201 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.AES_s.aes_encrypt_LE_reveal ()) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Pxor (va_op_xmm_xmm 10) (va_op_xmm_xmm 0)) (va_QBind va_range1
"***** PRECONDITION NOT MET AT line 205 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Store128_buffer (va_op_heaplet_mem_heaplet 5) (va_op_reg_opr64_reg64 rRax)
(va_op_xmm_xmm 10) 0 Secret inout_b 0) (fun (va_s:va_state) _ -> va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(fun (_:unit) -> Vale.AES.GCTR.gctr_partial_reveal ()) (va_QEmpty (()))))))))))))))
val va_lemma_Gcm_extra_bytes : va_b0:va_code -> va_s0:va_state -> alg:algorithm ->
inout_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> total_bytes:nat -> old_hash:quad32 -> completed_quads:(seq quad32) ->
h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_extra_bytes alg) va_s0 /\ va_get_ok va_s0 /\ (let
(len:(va_int_range 1 1)) = 1 in sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b
inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b inout_b /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax va_s0) inout_b
len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM (va_update_ok va_sM
(va_update_mem va_sM va_s0))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_extra_bytes va_b0 va_s0 alg inout_b key round_keys keys_b hkeys_b total_bytes
old_hash completed_quads h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8;
va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm
1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_extra_bytes va_mods alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_extra_bytes alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 121 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (let (len:(va_int_range 1 1)) = 1 in label va_range1
"***** POSTCONDITION NOT MET AT line 174 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 inout_b (va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 177 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg len (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0)) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let raw_quads = FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_s0) inout_b) in label va_range1
"***** POSTCONDITION NOT MET AT line 181 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(let input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in label va_range1
"***** POSTCONDITION NOT MET AT line 186 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(l_and (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE old_hash input_quads)))))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM)
[@ va_qattr]
let va_wp_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) (va_s0:va_state) (va_k:(va_state -> unit -> Type0))
: Type0 =
(va_get_ok va_s0 /\ (let (len:(va_int_range 1 1)) = 1 in sse_enabled /\
Vale.X64.Decls.buffers_disjoint128 keys_b inout_b /\ Vale.X64.Decls.buffers_disjoint128 hkeys_b
inout_b /\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 5 va_s0) (va_get_reg64 rRax
va_s0) inout_b len (va_get_mem_layout va_s0) Secret /\ len == Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 inout_b /\ va_get_xmm 9 va_s0 == Vale.Def.Words_s.Mkfour
#Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\ aes_reqs alg key round_keys
keys_b (va_get_reg64 rR8 va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\
pclmulqdq_enabled /\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0
va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret /\ va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32
(Vale.AES.GHash.ghash_incremental0 h_LE old_hash completed_quads) /\ FStar.Seq.Base.length
#quad32 completed_quads == total_bytes `op_Division` 16 /\ total_bytes < 16 `op_Multiply`
FStar.Seq.Base.length #quad32 completed_quads + 16 /\ va_get_reg64 rR10 va_s0 == total_bytes
`op_Modulus` 16 /\ total_bytes `op_Modulus` 16 =!= 0 /\ (0 < total_bytes /\ total_bytes < 16
`op_Multiply` Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\ 16 `op_Multiply`
(Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\ (forall
(va_x_mem:vale_heap) (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)
(va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)
(va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm10:quad32) (va_x_heap5:vale_heap)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 5
va_x_heap5 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7
(va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3
(va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rR11
va_x_r11 (va_upd_reg64 rRcx va_x_rcx (va_upd_mem va_x_mem va_s0)))))))))))))) in va_get_ok
va_sM /\ (let (len:(va_int_range 1 1)) = 1 in Vale.X64.Decls.modifies_buffer128 inout_b
(va_get_mem_heaplet 5 va_s0) (va_get_mem_heaplet 5 va_sM) /\ Vale.AES.GCTR.gctr_partial alg len
(Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0) inout_b) (Vale.X64.Decls.s128
(va_get_mem_heaplet 5 va_sM) inout_b) key (va_get_xmm 11 va_s0) /\ (let raw_quads =
FStar.Seq.Base.append #quad32 completed_quads (Vale.X64.Decls.s128 (va_get_mem_heaplet 5 va_s0)
inout_b) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8
(Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads) 0 total_bytes in let padded_bytes =
Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let input_quads =
Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in l_and (FStar.Seq.Base.length
#Vale.Def.Types_s.quad32 input_quads > 0) (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_sM) == Vale.AES.GHash.ghash_incremental h_LE old_hash input_quads))) ==> va_k va_sM (())))
val va_wpProof_Gcm_extra_bytes : alg:algorithm -> inout_b:buffer128 -> key:(seq nat32) ->
round_keys:(seq quad32) -> keys_b:buffer128 -> hkeys_b:buffer128 -> total_bytes:nat ->
old_hash:quad32 -> completed_quads:(seq quad32) -> h_LE:quad32 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gcm_extra_bytes alg) ([va_Mod_flags;
va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5;
va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11;
va_Mod_reg64 rRcx; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@"opaque_to_smt"]
let va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Gcm_extra_bytes (va_code_Gcm_extra_bytes alg) va_s0 alg inout_b key
round_keys keys_b hkeys_b total_bytes old_hash completed_quads h_LE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 5 va_sM (va_update_xmm 10
va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5
va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1
va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rRcx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))));
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10; va_Mod_xmm 8; va_Mod_xmm
7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1;
va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
[@ "opaque_to_smt" va_qattr]
let va_quick_Gcm_extra_bytes (alg:algorithm) (inout_b:buffer128) (key:(seq nat32)) (round_keys:(seq
quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32)
(completed_quads:(seq quad32)) (h_LE:quad32) : (va_quickCode unit (va_code_Gcm_extra_bytes alg)) =
(va_QProc (va_code_Gcm_extra_bytes alg) ([va_Mod_flags; va_Mod_mem_heaplet 5; va_Mod_xmm 10;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR11; va_Mod_reg64 rRcx; va_Mod_mem])
(va_wp_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b total_bytes old_hash
completed_quads h_LE) (va_wpProof_Gcm_extra_bytes alg inout_b key round_keys keys_b hkeys_b
total_bytes old_hash completed_quads h_LE))
//--
//-- Gcm_blocks128
val va_code_Gcm_blocks128 : alg:algorithm -> Tot va_code
[@ "opaque_to_smt" va_qattr]
let va_code_Gcm_blocks128 alg =
(va_Block (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_CCons
(va_code_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_CCons
(va_code_Ghash_buffer ()) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdi)
(va_op_opr64_reg64 rRbx)) (va_CCons (va_code_Mov64 (va_op_dst_opr64_reg64 rRdx)
(va_op_opr64_reg64 rR12)) (va_CCons (va_code_Gctr_blocks128 alg) (va_CNil ())))))))))
val va_codegen_success_Gcm_blocks128 : alg:algorithm -> Tot va_pbool
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Gcm_blocks128 alg =
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx))
(va_pbool_and (va_codegen_success_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax))
(va_pbool_and (va_codegen_success_Ghash_buffer ()) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_pbool_and (va_codegen_success_Mov64
(va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_pbool_and
(va_codegen_success_Gctr_blocks128 alg) (va_ttrue ()))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Gcm_blocks128 (va_mods:va_mods_t) (alg:algorithm) (in_b:buffer128) (out_b:buffer128)
(key:(seq nat32)) (round_keys:(seq quad32)) (keys_b:buffer128) (hkeys_b:buffer128) (h_LE:quad32)
: (va_quickCode unit (va_code_Gcm_blocks128 alg)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 274 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRbx) (va_op_opr64_reg64 rRdi)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 275 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rR12) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 276 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRax)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 277 column 17 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Ghash_buffer hkeys_b in_b h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8
va_old_s))) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 278 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRbx)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 279 column 10 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR12)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 280 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_quick_Gctr_blocks128 alg in_b out_b key round_keys keys_b) (va_QEmpty (()))))))))))
val va_lemma_Gcm_blocks128 : va_b0:va_code -> va_s0:va_state -> alg:algorithm -> in_b:buffer128 ->
out_b:buffer128 -> key:(seq nat32) -> round_keys:(seq quad32) -> keys_b:buffer128 ->
hkeys_b:buffer128 -> h_LE:quad32
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Gcm_blocks128 alg) va_s0 /\ va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\ (Vale.X64.Decls.buffers_disjoint128 in_b
out_b \/ in_b == out_b) /\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0) in_b (va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0) (va_get_reg64 rRdi va_s0) out_b
(va_get_reg64 rRdx va_s0) (va_get_mem_layout va_s0) Secret /\ va_get_reg64 rRax va_s0 + 16
`op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\ va_get_reg64 rRdi va_s0 + 16 `op_Multiply`
va_get_reg64 rRdx va_s0 < pow2_64 /\ l_and (Vale.X64.Decls.buffer_length
#Vale.X64.Memory.vuint128 in_b == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\ va_get_reg64 rRdx
va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\ va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\ aes_reqs alg key round_keys keys_b (va_get_reg64 rR8
va_s0) (va_get_mem_heaplet 0 va_s0) (va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\ Vale.X64.Decls.validSrcAddrs128
(va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32) hkeys_b 8 (va_get_mem_layout va_s0)
Secret)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM) /\ Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0) /\ va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0)
(va_get_reg64 rRdx va_s0) /\ (va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM ==
va_get_xmm 8 va_s0) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\ (va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==> FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b)))) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_mem_heaplet 1 va_sM (va_update_xmm 10 va_sM (va_update_xmm 11 va_sM (va_update_xmm 8
va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4
va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0
va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rR10 va_sM
(va_update_reg64 rR11 va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRbx va_sM
(va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Gcm_blocks128 va_b0 va_s0 alg in_b out_b key round_keys keys_b hkeys_b h_LE =
let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11;
va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm
2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem] in
let va_qc = va_qcode_Gcm_blocks128 va_mods alg in_b out_b key round_keys keys_b hkeys_b h_LE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Gcm_blocks128 alg) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 210 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 255 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.X64.Decls.modifies_buffer128 out_b (va_get_mem_heaplet 1 va_s0) (va_get_mem_heaplet 1
va_sM)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 261 column 95 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(Vale.AES.GCTR.gctr_partial alg (va_get_reg64 rRdx va_s0) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b) key
(va_get_xmm 11 va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 262 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_xmm 11 va_sM == Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx
va_s0)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 265 column 93 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 == 0 ==> l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b == Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) out_b)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 267 column 131 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMdecryptOpt.vaf *****"
(va_get_reg64 rRdx va_s0 > 0 ==> l_and (va_get_reg64 rRdx va_s0 <= FStar.Seq.Base.length
#Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==>
FStar.Seq.Base.length #Vale.X64.Decls.quad32 (FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) 0 (va_get_reg64 rRdx va_s0)) > 0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental
h_LE (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0)) (Vale.X64.Decls.s128
(va_get_mem_heaplet 1 va_s0) in_b))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 1; va_Mod_xmm 10; va_Mod_xmm 11; va_Mod_xmm
8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;
va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR12; va_Mod_reg64 rRdx; va_Mod_reg64 rR10;
va_Mod_reg64 rR11; va_Mod_reg64 rRdi; va_Mod_reg64 rRbx; va_Mod_ok; va_Mod_mem]) va_sM va_s0;
(va_sM, va_fM) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.Stack.fsti.checked",
"Vale.X64.QuickCodes.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.InsVector.fsti.checked",
"Vale.X64.InsStack.fsti.checked",
"Vale.X64.InsMem.fsti.checked",
"Vale.X64.InsBasic.fsti.checked",
"Vale.X64.InsAes.fsti.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Poly1305.Math.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Lib.Meta.fsti.checked",
"Vale.Lib.Basic.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Vale.AES.X64.GHash.fsti.checked",
"Vale.AES.X64.GF128_Mul.fsti.checked",
"Vale.AES.X64.GCTR.fsti.checked",
"Vale.AES.X64.GCMencryptOpt.fsti.checked",
"Vale.AES.X64.AESopt2.fsti.checked",
"Vale.AES.X64.AESopt.fsti.checked",
"Vale.AES.X64.AESGCM.fsti.checked",
"Vale.AES.X64.AES.fsti.checked",
"Vale.AES.OptPublic.fsti.checked",
"Vale.AES.GHash_s.fst.checked",
"Vale.AES.GHash.fsti.checked",
"Vale.AES.GF128_s.fsti.checked",
"Vale.AES.GF128.fsti.checked",
"Vale.AES.GCTR_s.fst.checked",
"Vale.AES.GCTR.fsti.checked",
"Vale.AES.GCM_s.fst.checked",
"Vale.AES.GCM_helpers.fsti.checked",
"Vale.AES.GCM.fsti.checked",
"Vale.AES.AES_s.fst.checked",
"Vale.AES.AES_common_s.fst.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.AES.X64.GCMdecryptOpt.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.Lib.Basic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.OptPublic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCMencryptOpt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Lib.Meta",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESGCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AESopt",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Math.Poly2.Bits_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GF128_Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsAes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Poly1305.Math",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GF128_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64.AES",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GHash_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.GCTR_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.AES_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.AES.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 20,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
alg: Vale.AES.AES_common_s.algorithm ->
in_b: Vale.X64.Memory.buffer128 ->
out_b: Vale.X64.Memory.buffer128 ->
key: FStar.Seq.Base.seq Vale.X64.Memory.nat32 ->
round_keys: FStar.Seq.Base.seq Vale.X64.Decls.quad32 ->
keys_b: Vale.X64.Memory.buffer128 ->
hkeys_b: Vale.X64.Memory.buffer128 ->
h_LE: Vale.X64.Decls.quad32 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.AES.AES_common_s.algorithm",
"Vale.X64.Memory.buffer128",
"FStar.Seq.Base.seq",
"Vale.X64.Memory.nat32",
"Vale.X64.Decls.quad32",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.sse_enabled",
"Vale.X64.Decls.buffers_disjoint128",
"Prims.l_or",
"Prims.eq2",
"Vale.X64.Decls.validSrcAddrs128",
"Vale.X64.Decls.va_get_mem_heaplet",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Decls.va_get_mem_layout",
"Vale.Arch.HeapTypes_s.Secret",
"Vale.X64.Decls.validDstAddrs128",
"Vale.X64.Machine_s.rRdi",
"Prims.op_LessThan",
"Prims.op_Addition",
"Prims.op_Multiply",
"Vale.X64.Machine_s.pow2_64",
"Prims.nat",
"Vale.X64.Decls.buffer_length",
"Vale.X64.Memory.vuint128",
"Vale.X64.Machine_s.pow2_32",
"Vale.Def.Words_s.four",
"Vale.Def.Types_s.nat32",
"Vale.X64.Decls.va_get_xmm",
"Vale.Def.Words_s.Mkfour",
"Vale.AES.X64.GCMencryptOpt.aes_reqs",
"Vale.X64.Machine_s.rR8",
"Vale.X64.CPU_Features_s.pclmulqdq_enabled",
"Vale.AES.GHash.hkeys_reqs_priv",
"Vale.X64.Decls.s128",
"Vale.Def.Types_s.reverse_bytes_quad32",
"Prims.op_Subtraction",
"Vale.X64.Machine_s.rR9",
"Prims.l_Forall",
"Vale.X64.InsBasic.vale_heap",
"Vale.X64.Memory.nat64",
"Vale.X64.Flags.t",
"Prims.l_imp",
"Vale.X64.Decls.modifies_buffer128",
"Vale.AES.GCTR.gctr_partial",
"Vale.Def.Types_s.quad32",
"Vale.AES.GCTR.inc32lite",
"Prims.int",
"Prims.op_GreaterThan",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"FStar.Seq.Base.slice",
"Vale.AES.GHash.ghash_incremental",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_flags",
"Vale.X64.Decls.va_upd_mem_heaplet",
"Vale.X64.Decls.va_upd_xmm",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rR12",
"Vale.X64.Machine_s.rR10",
"Vale.X64.Machine_s.rR11",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Decls.va_upd_mem"
] | [] | false | false | false | true | true | let va_wp_Gcm_blocks128
(alg: algorithm)
(in_b out_b: buffer128)
(key: (seq nat32))
(round_keys: (seq quad32))
(keys_b hkeys_b: buffer128)
(h_LE: quad32)
(va_s0: va_state)
(va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_get_ok va_s0 /\
(sse_enabled /\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\
Vale.X64.Decls.buffers_disjoint128 hkeys_b out_b /\
(Vale.X64.Decls.buffers_disjoint128 in_b out_b \/ in_b == out_b) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRax va_s0)
in_b
(va_get_reg64 rRdx va_s0)
(va_get_mem_layout va_s0)
Secret /\
Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 1 va_s0)
(va_get_reg64 rRdi va_s0)
out_b
(va_get_reg64 rRdx va_s0)
(va_get_mem_layout va_s0)
Secret /\ va_get_reg64 rRax va_s0 + 16 `op_Multiply` (va_get_reg64 rRdx va_s0) < pow2_64 /\
va_get_reg64 rRdi va_s0 + 16 `op_Multiply` (va_get_reg64 rRdx va_s0) < pow2_64 /\
l_and (Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b ==
Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b)
(Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b < pow2_32) /\
va_get_reg64 rRdx va_s0 == Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b /\
va_get_xmm 9 va_s0 ==
Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\
va_get_reg64 rRdx va_s0 < pow2_32 /\
aes_reqs alg
key
round_keys
keys_b
(va_get_reg64 rR8 va_s0)
(va_get_mem_heaplet 0 va_s0)
(va_get_mem_layout va_s0) /\ pclmulqdq_enabled /\
Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)
(Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\
Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)
(va_get_reg64 rR9 va_s0 - 32)
hkeys_b
8
(va_get_mem_layout va_s0)
Secret) /\
(forall (va_x_mem: vale_heap) (va_x_rbx: nat64) (va_x_rdi: nat64) (va_x_r11: nat64)
(va_x_r10: nat64) (va_x_rdx: nat64) (va_x_r12: nat64) (va_x_xmm0: quad32) (va_x_xmm1: quad32)
(va_x_xmm2: quad32) (va_x_xmm3: quad32) (va_x_xmm4: quad32) (va_x_xmm5: quad32)
(va_x_xmm6: quad32) (va_x_xmm7: quad32) (va_x_xmm8: quad32) (va_x_xmm11: quad32)
(va_x_xmm10: quad32) (va_x_heap1: vale_heap) (va_x_efl: Vale.X64.Flags.t).
let va_sM =
va_upd_flags va_x_efl
(va_upd_mem_heaplet 1
va_x_heap1
(va_upd_xmm 10
va_x_xmm10
(va_upd_xmm 11
va_x_xmm11
(va_upd_xmm 8
va_x_xmm8
(va_upd_xmm 7
va_x_xmm7
(va_upd_xmm 6
va_x_xmm6
(va_upd_xmm 5
va_x_xmm5
(va_upd_xmm 4
va_x_xmm4
(va_upd_xmm 3
va_x_xmm3
(va_upd_xmm 2
va_x_xmm2
(va_upd_xmm 1
va_x_xmm1
(va_upd_xmm 0
va_x_xmm0
(va_upd_reg64 rR12
va_x_r12
(va_upd_reg64 rRdx
va_x_rdx
(va_upd_reg64 rR10
va_x_r10
(va_upd_reg64 rR11
va_x_r11
(va_upd_reg64 rRdi
va_x_rdi
(va_upd_reg64 rRbx
va_x_rbx
(va_upd_mem va_x_mem
va_s0)))))))))
))))))))))
in
va_get_ok va_sM /\
(Vale.X64.Decls.modifies_buffer128 out_b
(va_get_mem_heaplet 1 va_s0)
(va_get_mem_heaplet 1 va_sM) /\
Vale.AES.GCTR.gctr_partial alg
(va_get_reg64 rRdx va_s0)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b)
key
(va_get_xmm 11 va_s0) /\
va_get_xmm 11 va_sM ==
Vale.AES.GCTR.inc32lite (va_get_xmm 11 va_s0) (va_get_reg64 rRdx va_s0) /\
(va_get_reg64 rRdx va_s0 == 0 ==>
l_and (va_get_xmm 8 va_sM == va_get_xmm 8 va_s0)
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_sM) out_b ==
Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) out_b)) /\
(va_get_reg64 rRdx va_s0 > 0 ==>
l_and (va_get_reg64 rRdx va_s0 <=
FStar.Seq.Base.length #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b) ==>
FStar.Seq.Base.length #Vale.X64.Decls.quad32
(FStar.Seq.Base.slice #Vale.X64.Decls.quad32
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)
0
(va_get_reg64 rRdx va_s0)) >
0)
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) ==
Vale.AES.GHash.ghash_incremental h_LE
(Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_s0))
(Vale.X64.Decls.s128 (va_get_mem_heaplet 1 va_s0) in_b)))) ==>
va_k va_sM (()))) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_VPshufb | val eval_VPshufb (src1 src2: quad32) : option quad32 | val eval_VPshufb (src1 src2: quad32) : option quad32 | let eval_VPshufb (src1 src2:quad32) : option quad32 = check_avx (eval_Pshufb_raw src1 src2) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 91,
"end_line": 240,
"start_col": 0,
"start_line": 240
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation)
let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2)
val ins_VShufpd (permutation:int) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation)
let is_full_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x04050607 &&
q.hi3 = 0x00010203
let is_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x00010203 &&
q.lo1 = 0x04050607 &&
q.hi2 = 0x08090A0B &&
q.hi3 = 0x0C0D0E0F
let is_high_dup_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let is_lower_upper_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x04050607 &&
q.lo1 = 0x00010203 &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let eval_Pshufb_raw (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if is_full_byte_reversal_mask src2 then
Some (reverse_bytes_quad32 src1)
else if is_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3))
else if is_high_dup_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else if is_lower_upper_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else None
let eval_Pshufb (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Pshufb_raw src1 src2)
val ins_Pshufb : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pshufb | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_avx",
"Vale.X64.Instructions_s.eval_Pshufb_raw",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_VPshufb (src1 src2: quad32) : option quad32 =
| check_avx (eval_Pshufb_raw src1 src2) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Mul64 | val eval_Mul64 (rax src: nat64) : option (nat64 & nat64) | val eval_Mul64 (rax src: nat64) : option (nat64 & nat64) | let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 71,
"end_line": 53,
"start_col": 0,
"start_line": 52
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | rax: Vale.X64.Machine_s.nat64 -> src: Vale.X64.Machine_s.nat64
-> FStar.Pervasives.Native.option (Vale.X64.Machine_s.nat64 * Vale.X64.Machine_s.nat64) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.nat64",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2",
"FStar.UInt.mul_div",
"FStar.UInt.mul_mod",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Mul64 (rax src: nat64) : option (nat64 & nat64) =
| Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Pslldq_raw | val eval_Pslldq_raw (count: nat8) (src: quad32) : option quad32 | val eval_Pslldq_raw (count: nat8) (src: quad32) : option quad32 | let eval_Pslldq_raw (count:nat8) (src:quad32) : option quad32 =
// We only spec the two very special cases we need
if count = 4 then Some (Mkfour 0 src.lo0 src.lo1 src.hi2)
else if count = 8 then Some (Mkfour 0 0 src.lo0 src.lo1)
else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 279,
"start_col": 0,
"start_line": 275
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation)
let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2)
val ins_VShufpd (permutation:int) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation)
let is_full_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x04050607 &&
q.hi3 = 0x00010203
let is_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x00010203 &&
q.lo1 = 0x04050607 &&
q.hi2 = 0x08090A0B &&
q.hi3 = 0x0C0D0E0F
let is_high_dup_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let is_lower_upper_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x04050607 &&
q.lo1 = 0x00010203 &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let eval_Pshufb_raw (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if is_full_byte_reversal_mask src2 then
Some (reverse_bytes_quad32 src1)
else if is_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3))
else if is_high_dup_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else if is_lower_upper_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else None
let eval_Pshufb (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Pshufb_raw src1 src2)
val ins_Pshufb : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pshufb
let eval_VPshufb (src1 src2:quad32) : option quad32 = check_avx (eval_Pshufb_raw src1 src2)
val ins_VPshufb : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPshufb
let eval_Pshufd (permutation:nat8) (src:quad32) : option quad32 = check_sse2 (
let bits:bits_of_byte = byte_to_twobits permutation in
Some (Mkfour
(select_word src bits.lo0)
(select_word src bits.lo1)
(select_word src bits.hi2)
(select_word src bits.hi3)))
val ins_Pshufd (permutation:nat8) :
instr_dep [out opXmm] [opXmm] PreserveFlags (eval_Pshufd permutation)
let eval_Pcmpeqd (dst src:quad32) : option quad32 = check_sse2 (
let eq_result (b:bool):nat32 = if b then 0xFFFFFFFF else 0 in
Some (Mkfour
(eq_result (src.lo0 = dst.lo0))
(eq_result (src.lo1 = dst.lo1))
(eq_result (src.hi2 = dst.hi2))
(eq_result (src.hi3 = dst.hi3))))
val ins_Pcmpeqd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pcmpeqd
let eval_Pextrq (index:nat8) (src:quad32) : option nat64 = check_sse4_1 (
let src_two = four_to_two_two src in
Some (two_to_nat 32 (two_select src_two (index % 2))))
val ins_Pextrq (index:nat8) : instr_dep [out op64] [opXmm] PreserveFlags (eval_Pextrq index)
let eval_Pinsrd (index:nat8) (dst:quad32) (src:nat64) : option quad32 =
check_sse4_1 (Some (insert_nat32 dst (src % pow2_32) (index % 4)))
val ins_Pinsrd (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrd index)
let eval_Pinsrq (index:nat8) (dst:quad32) (src:nat64) : option quad32 =
check_sse4_1 (Some (insert_nat64_def dst src (index % 2)))
val ins_Pinsrq (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrq index) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | count: Vale.Def.Types_s.nat8 -> src: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.Def.Types_s.nat8",
"Vale.X64.Machine_s.quad32",
"Prims.op_Equality",
"Prims.int",
"FStar.Pervasives.Native.Some",
"Vale.Def.Words_s.Mkfour",
"Vale.Def.Types_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Pslldq_raw (count: nat8) (src: quad32) : option quad32 =
| if count = 4
then Some (Mkfour 0 src.lo0 src.lo1 src.hi2)
else if count = 8 then Some (Mkfour 0 0 src.lo0 src.lo1) else None | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_VPclmulqdq | val eval_VPclmulqdq (imm: int) (src1 src2: quad32) : option quad32 | val eval_VPclmulqdq (imm: int) (src1 src2: quad32) : option quad32 | let eval_VPclmulqdq (imm:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Pclmulqdq imm src1 src2) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 42,
"end_line": 309,
"start_col": 0,
"start_line": 308
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation)
let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2)
val ins_VShufpd (permutation:int) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation)
let is_full_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x04050607 &&
q.hi3 = 0x00010203
let is_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x00010203 &&
q.lo1 = 0x04050607 &&
q.hi2 = 0x08090A0B &&
q.hi3 = 0x0C0D0E0F
let is_high_dup_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let is_lower_upper_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x04050607 &&
q.lo1 = 0x00010203 &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let eval_Pshufb_raw (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if is_full_byte_reversal_mask src2 then
Some (reverse_bytes_quad32 src1)
else if is_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3))
else if is_high_dup_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else if is_lower_upper_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else None
let eval_Pshufb (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Pshufb_raw src1 src2)
val ins_Pshufb : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pshufb
let eval_VPshufb (src1 src2:quad32) : option quad32 = check_avx (eval_Pshufb_raw src1 src2)
val ins_VPshufb : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPshufb
let eval_Pshufd (permutation:nat8) (src:quad32) : option quad32 = check_sse2 (
let bits:bits_of_byte = byte_to_twobits permutation in
Some (Mkfour
(select_word src bits.lo0)
(select_word src bits.lo1)
(select_word src bits.hi2)
(select_word src bits.hi3)))
val ins_Pshufd (permutation:nat8) :
instr_dep [out opXmm] [opXmm] PreserveFlags (eval_Pshufd permutation)
let eval_Pcmpeqd (dst src:quad32) : option quad32 = check_sse2 (
let eq_result (b:bool):nat32 = if b then 0xFFFFFFFF else 0 in
Some (Mkfour
(eq_result (src.lo0 = dst.lo0))
(eq_result (src.lo1 = dst.lo1))
(eq_result (src.hi2 = dst.hi2))
(eq_result (src.hi3 = dst.hi3))))
val ins_Pcmpeqd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pcmpeqd
let eval_Pextrq (index:nat8) (src:quad32) : option nat64 = check_sse4_1 (
let src_two = four_to_two_two src in
Some (two_to_nat 32 (two_select src_two (index % 2))))
val ins_Pextrq (index:nat8) : instr_dep [out op64] [opXmm] PreserveFlags (eval_Pextrq index)
let eval_Pinsrd (index:nat8) (dst:quad32) (src:nat64) : option quad32 =
check_sse4_1 (Some (insert_nat32 dst (src % pow2_32) (index % 4)))
val ins_Pinsrd (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrd index)
let eval_Pinsrq (index:nat8) (dst:quad32) (src:nat64) : option quad32 =
check_sse4_1 (Some (insert_nat64_def dst src (index % 2)))
val ins_Pinsrq (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrq index)
let eval_Pslldq_raw (count:nat8) (src:quad32) : option quad32 =
// We only spec the two very special cases we need
if count = 4 then Some (Mkfour 0 src.lo0 src.lo1 src.hi2)
else if count = 8 then Some (Mkfour 0 0 src.lo0 src.lo1)
else None
let eval_VPslldq (count:nat8) (src:quad32) : option quad32 = check_avx (eval_Pslldq_raw count src)
val ins_VPslldq (count:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_VPslldq count)
let eval_Psrldq_8_raw (count:nat8) (src:quad32) : option quad32 =
// We only spec the one very special case we need
if count = 8 then Some (Mkfour src.hi2 src.hi3 0 0)
else None
let eval_VPsrldq (count:nat8) (src:quad32) : option quad32 = check_avx (eval_Psrldq_8_raw count src)
val ins_VPsrldq (count:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_VPsrldq count)
let eval_Pclmulqdq (imm:int) (src1 src2:quad32) : option quad32 =
let Mkfour a0 a1 a2 a3 = src1 in
let Mkfour b0 b1 b2 b3 = src2 in
let f x0 x1 y0 y1 =
let x = Vale.Math.Poly2.Bits_s.of_double32 (Mktwo x0 x1) in
let y = Vale.Math.Poly2.Bits_s.of_double32 (Mktwo y0 y1) in
Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul x y)
in
if pclmulqdq_enabled then
match imm with
| 0 -> Some (f a0 a1 b0 b1)
| 1 -> Some (f a2 a3 b0 b1)
| 16 -> Some (f a0 a1 b2 b3)
| 17 -> Some (f a2 a3 b2 b3)
| _ -> None
else None
val ins_Pclmulqdq (imm:int) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Pclmulqdq imm) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | imm: Prims.int -> src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Prims.int",
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_avx",
"Vale.X64.Instructions_s.eval_Pclmulqdq",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_VPclmulqdq (imm: int) (src1 src2: quad32) : option quad32 =
| check_avx (eval_Pclmulqdq imm src1 src2) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Paddd_raw | val eval_Paddd_raw (src1 src2: quad32) : option quad32 | val eval_Paddd_raw (src1 src2: quad32) : option quad32 | let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32)) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 127,
"start_col": 0,
"start_line": 122
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"FStar.Pervasives.Native.Some",
"Vale.Def.Words_s.Mkfour",
"Vale.Def.Types_s.nat32",
"Prims.op_Modulus",
"Prims.op_Addition",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.X64.Machine_s.pow2_32",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Paddd_raw (src1 src2: quad32) : option quad32 =
| Some
(Mkfour ((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32)) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_Pshufd | val eval_Pshufd (permutation: nat8) (src: quad32) : option quad32 | val eval_Pshufd (permutation: nat8) (src: quad32) : option quad32 | let eval_Pshufd (permutation:nat8) (src:quad32) : option quad32 = check_sse2 (
let bits:bits_of_byte = byte_to_twobits permutation in
Some (Mkfour
(select_word src bits.lo0)
(select_word src bits.lo1)
(select_word src bits.hi2)
(select_word src bits.hi3))) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 32,
"end_line": 249,
"start_col": 0,
"start_line": 243
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation)
let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2)
val ins_VShufpd (permutation:int) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation)
let is_full_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x04050607 &&
q.hi3 = 0x00010203
let is_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x00010203 &&
q.lo1 = 0x04050607 &&
q.hi2 = 0x08090A0B &&
q.hi3 = 0x0C0D0E0F
let is_high_dup_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let is_lower_upper_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x04050607 &&
q.lo1 = 0x00010203 &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let eval_Pshufb_raw (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if is_full_byte_reversal_mask src2 then
Some (reverse_bytes_quad32 src1)
else if is_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3))
else if is_high_dup_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else if is_lower_upper_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else None
let eval_Pshufb (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Pshufb_raw src1 src2)
val ins_Pshufb : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pshufb
let eval_VPshufb (src1 src2:quad32) : option quad32 = check_avx (eval_Pshufb_raw src1 src2)
val ins_VPshufb : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPshufb | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | permutation: Vale.Def.Types_s.nat8 -> src: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.Def.Types_s.nat8",
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_sse2",
"FStar.Pervasives.Native.Some",
"Vale.Def.Words_s.Mkfour",
"Vale.Def.Types_s.nat32",
"Vale.Def.Types_s.select_word",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.Def.Types_s.twobits",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"Vale.Def.Types_s.bits_of_byte",
"Vale.Def.Types_s.byte_to_twobits",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_Pshufd (permutation: nat8) (src: quad32) : option quad32 =
| check_sse2 (let bits:bits_of_byte = byte_to_twobits permutation in
Some
(Mkfour (select_word src bits.lo0)
(select_word src bits.lo1)
(select_word src bits.hi2)
(select_word src bits.hi3))) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_VPslldq | val eval_VPslldq (count: nat8) (src: quad32) : option quad32 | val eval_VPslldq (count: nat8) (src: quad32) : option quad32 | let eval_VPslldq (count:nat8) (src:quad32) : option quad32 = check_avx (eval_Pslldq_raw count src) | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 98,
"end_line": 280,
"start_col": 0,
"start_line": 280
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation)
let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2)
val ins_VShufpd (permutation:int) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation)
let is_full_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x04050607 &&
q.hi3 = 0x00010203
let is_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x00010203 &&
q.lo1 = 0x04050607 &&
q.hi2 = 0x08090A0B &&
q.hi3 = 0x0C0D0E0F
let is_high_dup_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let is_lower_upper_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x04050607 &&
q.lo1 = 0x00010203 &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let eval_Pshufb_raw (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if is_full_byte_reversal_mask src2 then
Some (reverse_bytes_quad32 src1)
else if is_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3))
else if is_high_dup_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else if is_lower_upper_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else None
let eval_Pshufb (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Pshufb_raw src1 src2)
val ins_Pshufb : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pshufb
let eval_VPshufb (src1 src2:quad32) : option quad32 = check_avx (eval_Pshufb_raw src1 src2)
val ins_VPshufb : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPshufb
let eval_Pshufd (permutation:nat8) (src:quad32) : option quad32 = check_sse2 (
let bits:bits_of_byte = byte_to_twobits permutation in
Some (Mkfour
(select_word src bits.lo0)
(select_word src bits.lo1)
(select_word src bits.hi2)
(select_word src bits.hi3)))
val ins_Pshufd (permutation:nat8) :
instr_dep [out opXmm] [opXmm] PreserveFlags (eval_Pshufd permutation)
let eval_Pcmpeqd (dst src:quad32) : option quad32 = check_sse2 (
let eq_result (b:bool):nat32 = if b then 0xFFFFFFFF else 0 in
Some (Mkfour
(eq_result (src.lo0 = dst.lo0))
(eq_result (src.lo1 = dst.lo1))
(eq_result (src.hi2 = dst.hi2))
(eq_result (src.hi3 = dst.hi3))))
val ins_Pcmpeqd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pcmpeqd
let eval_Pextrq (index:nat8) (src:quad32) : option nat64 = check_sse4_1 (
let src_two = four_to_two_two src in
Some (two_to_nat 32 (two_select src_two (index % 2))))
val ins_Pextrq (index:nat8) : instr_dep [out op64] [opXmm] PreserveFlags (eval_Pextrq index)
let eval_Pinsrd (index:nat8) (dst:quad32) (src:nat64) : option quad32 =
check_sse4_1 (Some (insert_nat32 dst (src % pow2_32) (index % 4)))
val ins_Pinsrd (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrd index)
let eval_Pinsrq (index:nat8) (dst:quad32) (src:nat64) : option quad32 =
check_sse4_1 (Some (insert_nat64_def dst src (index % 2)))
val ins_Pinsrq (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrq index)
let eval_Pslldq_raw (count:nat8) (src:quad32) : option quad32 =
// We only spec the two very special cases we need
if count = 4 then Some (Mkfour 0 src.lo0 src.lo1 src.hi2)
else if count = 8 then Some (Mkfour 0 0 src.lo0 src.lo1) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | count: Vale.Def.Types_s.nat8 -> src: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.Def.Types_s.nat8",
"Vale.X64.Machine_s.quad32",
"Vale.X64.Instructions_s.check_avx",
"Vale.X64.Instructions_s.eval_Pslldq_raw",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_VPslldq (count: nat8) (src: quad32) : option quad32 =
| check_avx (eval_Pslldq_raw count src) | false |
Vale.X64.Instructions_s.fsti | Vale.X64.Instructions_s.eval_AESNI_dec_last | val eval_AESNI_dec_last (dst src: quad32) : option quad32 | val eval_AESNI_dec_last (dst src: quad32) : option quad32 | let eval_AESNI_dec_last (dst src:quad32) : option quad32 =
if aesni_enabled then
Some (quad32_xor (Vale.AES.AES_s.inv_sub_bytes (Vale.AES.AES_s.inv_shift_rows_LE dst)) src)
else None | {
"file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 11,
"end_line": 339,
"start_col": 0,
"start_line": 336
} | module Vale.X64.Instructions_s
open FStar.Mul
open Vale.Def.Words_s
open Vale.Def.Words.Two_s
open Vale.Def.Words.Four_s
open Vale.Def.Types_s
open Vale.X64.Machine_s
open Vale.X64.Instruction_s
open Vale.X64.CPU_Features_s
open Vale.X64.CryptoInstructions_s
open FStar.Seq.Base
let eval_Mov64 (src:nat64) : option nat64 = Some src
val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64
let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst)
val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64
let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst)
val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64
let eval_Add64 (dst src:nat64) : option (bool & nat64) =
let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64)
val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64
let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64)
val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64
let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_carry then 1 else 0) in
Some (sum >= pow2_64, sum % pow2_64)
val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64
let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) =
let sum = dst + src + (if old_flag then 1 else 0) in
if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None
val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64
let eval_Sub64 (dst src:nat64) : option (bool & nat64) =
let diff = dst - src in Some (diff < 0, diff % pow2_64)
val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64
let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) =
let diff = dst - (src + (if old_carry then 1 else 0)) in
Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags)
val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64
let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) =
Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src)
val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64
let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) =
let hi = FStar.UInt.mul_div #64 rdx src in
let lo = FStar.UInt.mul_mod #64 rdx src in
if bmi2_enabled then Some (hi, lo) else None
val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64
let eval_IMul64 (dst src:nat64) : option nat64 =
Some (FStar.UInt.mul_mod #64 dst src)
val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64
let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src)
val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) =
Some (Vale.Def.Types_s.ixor dst src, (false, false))
val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64
let eval_Shr64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None
val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
let eval_Shl64 (dst amt:nat64) : option nat64 =
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64
let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) =
Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx)))
val ins_Cpuid :
instr_dep
[inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)]
[] PreserveFlags eval_Cpuid
// The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled.
// We underspecify XGETBV here to only support fetching XCR0, which
// is supported on any processor supporting the XGETBV instruction
let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) =
if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None
val ins_Xgetbv :
instr_dep
[out (one64Reg rRax); out (one64Reg rRdx)]
[one64Reg rRcx] PreserveFlags eval_Xgetbv
let check_avx (#a:Type0) (x:option a) : option a =
if avx_enabled then x else None
let check_sse2 (#a:Type0) (x:option a) : option a =
if sse2_enabled then x else None
let check_ssse3 (#a:Type0) (x:option a) : option a =
if ssse3_enabled then x else None
let check_sse4_1 (#a:Type0) (x:option a) : option a =
if sse4_1_enabled then x else None
let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src)
val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu
let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src))
val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor
let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src))
val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand
let eval_Paddd_raw (src1 src2:quad32) : option quad32 =
Some (Mkfour
((src1.lo0 + src2.lo0) % pow2_32)
((src1.lo1 + src2.lo1) % pow2_32)
((src1.hi2 + src2.hi2) % pow2_32)
((src1.hi3 + src2.hi3) % pow2_32))
let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
let eval_Pslld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt)
let eval_Psrld (amt:int) (dst:quad32) : option quad32 =
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None)
val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt)
let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 (
if 0 <= amt && amt < 16 then
let src_bytes = le_quad32_to_bytes dst in
let zero_pad = Seq.create amt 0 in
let remaining_bytes = slice src_bytes amt (length src_bytes) in
Some (le_bytes_to_quad32 (append zero_pad remaining_bytes))
else None)
val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt)
let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if amount = 4 then
Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0)
else if amount = 8 then
Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1)
else None
let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_ssse3 (eval_Palignr_raw amount src1 src2)
val ins_Palignr (amount:nat8) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 =
check_avx (eval_Palignr_raw amount src1 src2)
val ins_VPalignr (amount:nat8) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 =
if 0 <= permutation && permutation < 4 then
Some (Mkfour
(if permutation % 2 = 0 then src1.lo0 else src1.hi2)
(if permutation % 2 = 0 then src1.lo1 else src1.hi3)
(if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2)
(if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3))
else None
let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_sse2 (eval_Shufpd_raw permutation src1 src2)
val ins_Shufpd (permutation:int) :
instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation)
let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Shufpd_raw permutation src1 src2)
val ins_VShufpd (permutation:int) :
instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation)
let is_full_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x04050607 &&
q.hi3 = 0x00010203
let is_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x00010203 &&
q.lo1 = 0x04050607 &&
q.hi2 = 0x08090A0B &&
q.hi3 = 0x0C0D0E0F
let is_high_dup_reversal_mask (q:quad32) : bool =
q.lo0 = 0x0C0D0E0F &&
q.lo1 = 0x08090A0B &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let is_lower_upper_byte_reversal_mask (q:quad32) : bool =
q.lo0 = 0x04050607 &&
q.lo1 = 0x00010203 &&
q.hi2 = 0x0C0D0E0F &&
q.hi3 = 0x08090A0B
let eval_Pshufb_raw (src1 src2:quad32) : option quad32 =
// We only spec a restricted version sufficient for a handful of standard patterns
if is_full_byte_reversal_mask src2 then
Some (reverse_bytes_quad32 src1)
else if is_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3))
else if is_high_dup_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else if is_lower_upper_byte_reversal_mask src2 then
Some (Mkfour
(reverse_bytes_nat32 src1.lo1)
(reverse_bytes_nat32 src1.lo0)
(reverse_bytes_nat32 src1.hi3)
(reverse_bytes_nat32 src1.hi2))
else None
let eval_Pshufb (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Pshufb_raw src1 src2)
val ins_Pshufb : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pshufb
let eval_VPshufb (src1 src2:quad32) : option quad32 = check_avx (eval_Pshufb_raw src1 src2)
val ins_VPshufb : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPshufb
let eval_Pshufd (permutation:nat8) (src:quad32) : option quad32 = check_sse2 (
let bits:bits_of_byte = byte_to_twobits permutation in
Some (Mkfour
(select_word src bits.lo0)
(select_word src bits.lo1)
(select_word src bits.hi2)
(select_word src bits.hi3)))
val ins_Pshufd (permutation:nat8) :
instr_dep [out opXmm] [opXmm] PreserveFlags (eval_Pshufd permutation)
let eval_Pcmpeqd (dst src:quad32) : option quad32 = check_sse2 (
let eq_result (b:bool):nat32 = if b then 0xFFFFFFFF else 0 in
Some (Mkfour
(eq_result (src.lo0 = dst.lo0))
(eq_result (src.lo1 = dst.lo1))
(eq_result (src.hi2 = dst.hi2))
(eq_result (src.hi3 = dst.hi3))))
val ins_Pcmpeqd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pcmpeqd
let eval_Pextrq (index:nat8) (src:quad32) : option nat64 = check_sse4_1 (
let src_two = four_to_two_two src in
Some (two_to_nat 32 (two_select src_two (index % 2))))
val ins_Pextrq (index:nat8) : instr_dep [out op64] [opXmm] PreserveFlags (eval_Pextrq index)
let eval_Pinsrd (index:nat8) (dst:quad32) (src:nat64) : option quad32 =
check_sse4_1 (Some (insert_nat32 dst (src % pow2_32) (index % 4)))
val ins_Pinsrd (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrd index)
let eval_Pinsrq (index:nat8) (dst:quad32) (src:nat64) : option quad32 =
check_sse4_1 (Some (insert_nat64_def dst src (index % 2)))
val ins_Pinsrq (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrq index)
let eval_Pslldq_raw (count:nat8) (src:quad32) : option quad32 =
// We only spec the two very special cases we need
if count = 4 then Some (Mkfour 0 src.lo0 src.lo1 src.hi2)
else if count = 8 then Some (Mkfour 0 0 src.lo0 src.lo1)
else None
let eval_VPslldq (count:nat8) (src:quad32) : option quad32 = check_avx (eval_Pslldq_raw count src)
val ins_VPslldq (count:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_VPslldq count)
let eval_Psrldq_8_raw (count:nat8) (src:quad32) : option quad32 =
// We only spec the one very special case we need
if count = 8 then Some (Mkfour src.hi2 src.hi3 0 0)
else None
let eval_VPsrldq (count:nat8) (src:quad32) : option quad32 = check_avx (eval_Psrldq_8_raw count src)
val ins_VPsrldq (count:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_VPsrldq count)
let eval_Pclmulqdq (imm:int) (src1 src2:quad32) : option quad32 =
let Mkfour a0 a1 a2 a3 = src1 in
let Mkfour b0 b1 b2 b3 = src2 in
let f x0 x1 y0 y1 =
let x = Vale.Math.Poly2.Bits_s.of_double32 (Mktwo x0 x1) in
let y = Vale.Math.Poly2.Bits_s.of_double32 (Mktwo y0 y1) in
Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul x y)
in
if pclmulqdq_enabled then
match imm with
| 0 -> Some (f a0 a1 b0 b1)
| 1 -> Some (f a2 a3 b0 b1)
| 16 -> Some (f a0 a1 b2 b3)
| 17 -> Some (f a2 a3 b2 b3)
| _ -> None
else None
val ins_Pclmulqdq (imm:int) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Pclmulqdq imm)
let eval_VPclmulqdq (imm:int) (src1 src2:quad32) : option quad32 =
check_avx (eval_Pclmulqdq imm src1 src2)
val ins_VPclmulqdq (imm:int) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPclmulqdq imm)
let eval_AESNI_enc (src1 src2:quad32) : option quad32 =
if aesni_enabled then
Some (quad32_xor (Vale.AES.AES_s.mix_columns_LE (Vale.AES.AES_s.sub_bytes (Vale.AES.AES_s.shift_rows_LE src1))) src2)
else None
val ins_AESNI_enc : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_AESNI_enc
let eval_VAESNI_enc (src1 src2:quad32) : option quad32 = check_avx (eval_AESNI_enc src1 src2)
val ins_VAESNI_enc : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VAESNI_enc
let eval_AESNI_enc_last (src1 src2:quad32) : option quad32 =
if aesni_enabled then
Some (quad32_xor (Vale.AES.AES_s.sub_bytes (Vale.AES.AES_s.shift_rows_LE src1)) src2)
else None
val ins_AESNI_enc_last : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_AESNI_enc_last
let eval_VAESNI_enc_last (src1 src2:quad32) : option quad32 = check_avx (eval_AESNI_enc_last src1 src2)
val ins_VAESNI_enc_last : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VAESNI_enc_last
let eval_AESNI_dec (dst src:quad32) : option quad32 =
if aesni_enabled then
Some (quad32_xor (Vale.AES.AES_s.inv_mix_columns_LE (Vale.AES.AES_s.inv_sub_bytes (Vale.AES.AES_s.inv_shift_rows_LE dst))) src)
else None
val ins_AESNI_dec : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_AESNI_dec | {
"checked_file": "/",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Instruction_s.fsti.checked",
"Vale.X64.CryptoInstructions_s.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Math.Poly2_s.fsti.checked",
"Vale.Math.Poly2.Bits_s.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Two_s.fsti.checked",
"Vale.Def.Words.Four_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.AES.AES_s.fst.checked",
"prims.fst.checked",
"FStar.UInt.fsti.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Instructions_s.fsti"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CryptoInstructions_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Instruction_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Four_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Two_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Machine_s.quad32 -> src: Vale.X64.Machine_s.quad32
-> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Machine_s.quad32",
"Vale.X64.CPU_Features_s.aesni_enabled",
"FStar.Pervasives.Native.Some",
"Vale.Def.Types_s.quad32_xor",
"Vale.AES.AES_common_s.inv_sub_bytes",
"Vale.AES.AES_s.inv_shift_rows_LE",
"Prims.bool",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.option"
] | [] | false | false | false | true | false | let eval_AESNI_dec_last (dst src: quad32) : option quad32 =
| if aesni_enabled
then Some (quad32_xor (Vale.AES.AES_s.inv_sub_bytes (Vale.AES.AES_s.inv_shift_rows_LE dst)) src)
else None | false |
Pulse.Checker.Base.fst | Pulse.Checker.Base.st_equiv_pre | val st_equiv_pre
(#g: env)
(#t: st_term)
(#c: comp_st)
(d: st_typing g t c)
(pre: term)
(veq: vprop_equiv g (comp_pre c) pre)
: st_typing g t (comp_with_pre c pre) | val st_equiv_pre
(#g: env)
(#t: st_term)
(#c: comp_st)
(d: st_typing g t c)
(pre: term)
(veq: vprop_equiv g (comp_pre c) pre)
: st_typing g t (comp_with_pre c pre) | let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(pre:term)
(veq: vprop_equiv g (comp_pre c) pre)
: st_typing g t (comp_with_pre c pre)
= if eq_tm pre (comp_pre c) then d
else
let c' = comp_with_pre c pre in
let (| u_of, pre_typing, x, post_typing |) =
Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _)
in
t_equiv d st_equiv | {
"file_name": "lib/steel/pulse/Pulse.Checker.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 24,
"end_line": 309,
"start_col": 0,
"start_line": 297
} | (*
Copyright 2023 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Pulse.Checker.Base
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module Metatheory = Pulse.Typing.Metatheory
module CP = Pulse.Checker.Pure
module RU = Pulse.RuntimeUtils
module FV = Pulse.Typing.FV
module P = Pulse.Syntax.Printer
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
let debug (g:env) (f: unit -> T.Tac string) : T.Tac unit =
if RU.debug_at_level (fstar_env g) "pulse.checker" then
T.print (f())
let format_failed_goal (g:env) (ctxt:list term) (goal:list term) =
let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in
let numbered_list ss =
let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in
String.concat "\n " (List.rev s)
in
let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in
Printf.sprintf
"Failed to prove the following goals:\n \
%s\n\
The remaining conjuncts in the separation logic context available for use are:\n \
%s\n\
The typing context is:\n \
%s\n"
(format_terms goal)
(format_terms ctxt)
(env_to_string g)
let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let intro_comp_typing (g:env)
(c:comp_st)
(pre_typing:tot_typing g (comp_pre c) tm_vprop)
(i_typing:effect_annot_typing g (effect_annot_of_comp c))
(res_typing:universe_of g (comp_res c) (comp_u c))
(x:var { fresh_wrt x g (freevars (comp_post c)) })
(post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
: T.Tac (comp_typing g c (universe_of_comp c))
= let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\
comp_pre c == st.pre /\
comp_res c == st.res /\
comp_post c == st.post } )
: T.Tac (st_comp_typing g st)
= STC g st x res_typing pre_typing post_typing
in
match c with
| C_ST st ->
let stc = intro_st_comp_typing st in
CT_ST _ _ stc
| C_STAtomic i obs st ->
let stc = intro_st_comp_typing st in
CT_STAtomic _ i obs _ i_typing stc
| C_STGhost st ->
let stc = intro_st_comp_typing st in
CT_STGhost _ _ stc
irreducible
let post_typing_as_abstraction
(#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) })
(_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop)
: FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop))
= admit()
let check_effect_annot (g:env) (e:effect_annot) : T.Tac (effect_annot_typing g e) =
match e with
| EffectAnnotSTT
| EffectAnnotGhost -> ()
| EffectAnnotAtomic { opens } ->
CP.core_check_term g opens T.E_Total tm_inames
let intro_post_hint g effect_annot ret_ty_opt post =
let x = fresh g in
let ret_ty =
match ret_ty_opt with
| None -> tm_fstar RT.unit_ty FStar.Range.range_0
| Some t -> t
in
let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in
let (| u, ty_typing |) = CP.check_universe g ret_ty in
let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in
let post' = close_term post x in
Pulse.Typing.FV.freevars_close_term post x 0;
let effect_annot_typing = check_effect_annot g effect_annot in
assume (open_term post' x == post);
{ g;
effect_annot;
effect_annot_typing;
ret_ty; u; ty_typing;
post=post';
x; post_typing_src=post_typing;
post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
let comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)
: effect_annot_typing g (effect_annot_of_comp c)
= let _, iname_typing = Metatheory.comp_typing_inversion ct in
match c with
| C_ST _ -> ()
| C_STGhost _ -> ()
| C_STAtomic opens obs _ -> iname_typing
let post_hint_from_comp_typing #g #c ct =
let st_comp_typing, _ = Metatheory.comp_typing_inversion ct in
let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in
let effect_annot_typing = comp_typing_as_effect_annot_typing ct in
let p : post_hint_t =
{ g;
effect_annot=_;
effect_annot_typing;
ret_ty = comp_res c; u=comp_u c;
ty_typing=ty_typing;
post=comp_post c;
x;
post_typing_src=post_typing;
post_typing=post_typing_as_abstraction post_typing }
in
p
let comp_typing_from_post_hint
(#g: env)
(c: comp_st)
(pre_typing: tot_typing g (comp_pre c) tm_vprop)
(p:post_hint_for_env g { comp_post_matches_hint c (Some p) })
: T.Tac (comp_typing_u g c)
= let x = fresh g in
if x `Set.mem` freevars p.post //exclude this
then fail g None "Impossible: unexpected freevar in post, please file a bug-report"
else let post_typing = post_hint_typing g p x in
intro_comp_typing g c pre_typing
post_typing.effect_annot_typing
post_typing.ty_typing
x post_typing.post_typing
let extend_post_hint g p x tx conjunct conjunct_typing =
let g' = push_binding g x ppname_default tx in
let y = fresh g' in
let g'' = push_binding g' y ppname_default p.ret_ty in
let p_post_typing_src
: tot_typing (push_binding p.g p.x ppname_default p.ret_ty)
(open_term p.post p.x) tm_vprop
= p.post_typing_src
in
let p_post_typing_src''
: tot_typing g'' (open_term p.post y) tm_vprop
= RU.magic () //weaken, rename
in
let conjunct_typing'
: tot_typing g' conjunct tm_vprop
= conjunct_typing
in
let conjunct_typing''
: tot_typing g'' (open_term conjunct y) tm_vprop
= RU.magic () //weaken
in
let new_post = tm_star p.post conjunct in
let new_post_typing
: tot_typing g'' (open_term new_post y) tm_vprop
= Pulse.Typing.star_typing p_post_typing_src'' conjunct_typing''
in
assume (fresh_wrt y g'' (freevars new_post));
let new_post_abs_typing
: Ghost.erased (RT.tot_typing (elab_env g'') (mk_abs p.ret_ty new_post) (mk_arrow p.ret_ty tm_vprop))
= post_typing_as_abstraction new_post_typing
in
{ p with
g=g';
post=new_post;
x=y;
post_typing_src=new_post_typing;
post_typing=new_post_abs_typing }
let k_elab_unit (g:env) (ctxt:term)
: continuation_elaborator g ctxt g ctxt
= fun p r -> r
let k_elab_trans
(#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term)
(k0:continuation_elaborator g0 ctxt0 g1 ctxt1)
(k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
: continuation_elaborator g0 ctxt0 g2 ctxt2
= fun post_hint res -> k0 post_hint (k1 post_hint res)
let comp_st_with_post (c:comp_st) (post:term)
: c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } =
match c with
| C_ST st -> C_ST { st with post }
| C_STGhost st -> C_STGhost { st with post }
| C_STAtomic i obs st -> C_STAtomic i obs {st with post}
let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p =
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)
: option (st_equiv g c0 c2)
=
match d01 with
| ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 -> (
let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in
if x = y && eq_tm (comp_res c0) (comp_res c1)
then Some (
ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing
(RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)
(VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)
(VE_Trans _ _ _ _ eq_post_01 eq_post_12)
)
else None
)
| ST_TotEquiv g t1 t2 u typing eq ->
let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in
let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in
Some (ST_TotEquiv g t1 t3 u typing eq'')
let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c')
: st_typing g st c'
= match d with
| T_Equiv _ _ _ _ d0 eq' -> (
match st_equiv_trans eq' eq with
| None -> T_Equiv _ _ _ _ d eq
| Some eq'' -> T_Equiv _ _ _ _ d0 eq''
)
| _ -> T_Equiv _ _ _ _ d eq
let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { freevars post `Set.subset` freevars (comp_post c)})
(veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } ->
vprop_equiv (push_binding g x ppname_default (comp_res c))
(open_term (comp_post c) x)
(open_term post x)))
: st_typing g t (comp_st_with_post c post)
= if eq_tm post (comp_post c) then d
else
let c' = comp_st_with_post c post in
let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in
let veq = veq x in
let st_equiv : st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq
in
t_equiv d st_equiv
let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)
(post:term { comp_post c == tm_star post tm_emp})
: st_typing g t (comp_st_with_post c post)
= st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x))
let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t)
: Lemma
(requires
comp_post_matches_hint c post_hint /\
effect_annot_of_comp c == effect_annot_of_comp c' /\
comp_res c' == comp_res c /\
comp_u c' == comp_u c /\
comp_post c' == tm_star (comp_post c) tm_emp)
(ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\
comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c')
= ()
let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)
(#p:_) (d:vprop_equiv g p ctxt)
: tot_typing g p tm_vprop
= let _, bk = vprop_equiv_typing d in
bk ctxt_typing
let comp_with_pre (c:comp_st) (pre:term) =
match c with
| C_ST st -> C_ST { st with pre }
| C_STGhost st -> C_STGhost { st with pre }
| C_STAtomic i obs st -> C_STAtomic i obs {st with pre} | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.Base.fsti.checked",
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.LN.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Readback.fsti.checked",
"Pulse.PP.fst.checked",
"Pulse.Checker.Pure.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.String.fsti.checked",
"FStar.Squash.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Reflection.V2.TermEq.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Range.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Base.fst"
} | [
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Pure",
"short_module": "CP"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
d: Pulse.Typing.st_typing g t c ->
pre: Pulse.Syntax.Base.term ->
veq: Pulse.Typing.vprop_equiv g (Pulse.Syntax.Base.comp_pre c) pre
-> Pulse.Typing.st_typing g t (Pulse.Checker.Base.comp_with_pre c pre) | Prims.Tot | [
"total"
] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp_st",
"Pulse.Typing.st_typing",
"Pulse.Syntax.Base.term",
"Pulse.Typing.vprop_equiv",
"Pulse.Syntax.Base.comp_pre",
"Pulse.Syntax.Base.eq_tm",
"Prims.bool",
"Pulse.Typing.universe_of",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__res",
"Pulse.Syntax.Base.st_comp_of_comp",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__u",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__pre",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Syntax.Base.var",
"Pulse.Typing.fresh_wrt",
"Pulse.Syntax.Naming.freevars",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__post",
"Pulse.Typing.Env.push_binding",
"Pulse.Syntax.Base.ppname_default",
"Pulse.Syntax.Naming.open_term",
"Pulse.Checker.Base.t_equiv",
"Pulse.Typing.st_equiv",
"Pulse.Typing.ST_VPropEquiv",
"FStar.Reflection.Typing.Rel_refl",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Syntax.Base.comp_res",
"FStar.Reflection.Typing.R_Eq",
"Pulse.Typing.VE_Refl",
"Pulse.Syntax.Base.comp_post",
"Pulse.Checker.Base.comp_with_pre",
"FStar.Pervasives.dtuple4",
"Pulse.Typing.Metatheory.Base.st_comp_typing_inversion",
"FStar.Pervasives.Native.fst",
"Pulse.Typing.st_comp_typing",
"Pulse.Typing.Metatheory.Base.iname_typing",
"Pulse.Typing.Metatheory.Base.comp_typing_inversion",
"Pulse.Typing.Metatheory.Base.st_typing_correctness",
"Pulse.Syntax.Base.comp"
] | [] | false | false | false | false | false | let st_equiv_pre
(#g: env)
(#t: st_term)
(#c: comp_st)
(d: st_typing g t c)
(pre: term)
(veq: vprop_equiv g (comp_pre c) pre)
: st_typing g t (comp_with_pre c pre) =
| if eq_tm pre (comp_pre c)
then d
else
let c' = comp_with_pre c pre in
let (| u_of , pre_typing , x , post_typing |) =
let open Metatheory in
st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))
in
let st_equiv:st_equiv g c c' =
ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _)
in
t_equiv d st_equiv | false |