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
DPE.Messages.Spec.fst
DPE.Messages.Spec.seal_new_context_handle
val seal_new_context_handle : FStar.UInt64.t
let seal_new_context_handle = 2uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 33, "end_line": 663, "start_col": 0, "start_line": 663 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let seal_new_context_handle =
2uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.seal_sealed_data
val seal_sealed_data : FStar.UInt64.t
let seal_sealed_data = 1uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 26, "end_line": 661, "start_col": 0, "start_line": 661 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let seal_sealed_data =
1uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.unseal_label
val unseal_label : FStar.UInt64.t
let unseal_label = 4uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 22, "end_line": 687, "start_col": 0, "start_line": 687 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let unseal_label =
4uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.unseal_retain_context
val unseal_retain_context : FStar.UInt64.t
let unseal_retain_context = 2uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 31, "end_line": 683, "start_col": 0, "start_line": 683 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let unseal_retain_context =
2uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.unseal_context_handle
val unseal_context_handle : FStar.UInt64.t
let unseal_context_handle = 1uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 31, "end_line": 681, "start_col": 0, "start_line": 681 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let unseal_context_handle =
1uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.unseal_is_asymmetric
val unseal_is_asymmetric : FStar.UInt64.t
let unseal_is_asymmetric = 3uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 30, "end_line": 685, "start_col": 0, "start_line": 685 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let unseal_is_asymmetric =
3uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.unseal_input_args
val unseal_input_args : CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
let unseal_input_args = Cddl.t_map unseal_input_args_group
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 74, "end_line": 705, "start_col": 16, "start_line": 705 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_map", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "DPE.Messages.Spec.unseal_input_args_group" ]
[]
false
false
false
true
false
let unseal_input_args =
Cddl.t_map unseal_input_args_group
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.unseal_data_to_unseal
val unseal_data_to_unseal : FStar.UInt64.t
let unseal_data_to_unseal = 5uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 31, "end_line": 689, "start_col": 0, "start_line": 689 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let unseal_data_to_unseal =
5uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.derive_sealing_unseal_policy
val derive_sealing_unseal_policy : FStar.UInt64.t
let derive_sealing_unseal_policy = 3uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 38, "end_line": 732, "start_col": 0, "start_line": 732 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let derive_sealing_unseal_policy =
3uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.unseal_input_args_group
val unseal_input_args_group : CDDL.Spec.map_group FStar.Pervasives.Native.None
let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))))
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 5, "end_line": 698, "start_col": 0, "start_line": 691 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.map_group FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.map_group_cons_zero_or_one", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "CDDL.Spec.MapGroupEntry", "CDDL.Spec.t_uint_literal", "DPE.Messages.Spec.unseal_context_handle", "CDDL.Spec.bytes", "DPE.Messages.Spec.unseal_retain_context", "CDDL.Spec.t_bool", "DPE.Messages.Spec.unseal_is_asymmetric", "DPE.Messages.Spec.unseal_label", "DPE.Messages.Spec.unseal_data_to_unseal", "DPE.Messages.Spec.default_args_group" ]
[]
false
false
false
true
false
let unseal_input_args_group =
Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal unseal_context_handle) Cddl.bytes) false (Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal unseal_retain_context) Cddl.t_bool) false (Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal unseal_is_asymmetric) Cddl.t_bool) false (Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal unseal_label) Cddl.bytes) false (Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal unseal_data_to_unseal) Cddl.bytes) false (default_args_group)))))
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.unseal_output_args_group
val unseal_output_args_group : CDDL.Spec.map_group FStar.Pervasives.Native.None
let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 2, "end_line": 716, "start_col": 0, "start_line": 712 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.map_group FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.map_group_cons_zero_or_one", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "CDDL.Spec.MapGroupEntry", "CDDL.Spec.t_uint_literal", "DPE.Messages.Spec.unseal_unsealed_data", "CDDL.Spec.bytes", "DPE.Messages.Spec.unseal_new_context_handle", "DPE.Messages.Spec.default_args_group" ]
[]
false
false
false
true
false
let unseal_output_args_group =
Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal unseal_unsealed_data) Cddl.bytes) false (Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal unseal_new_context_handle) Cddl.bytes) false (default_args_group))
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.unseal_unsealed_data
val unseal_unsealed_data : FStar.UInt64.t
let unseal_unsealed_data = 1uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 30, "end_line": 708, "start_col": 0, "start_line": 708 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let unseal_unsealed_data =
1uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.derive_sealing_retain_context
val derive_sealing_retain_context : FStar.UInt64.t
let derive_sealing_retain_context = 2uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 39, "end_line": 730, "start_col": 0, "start_line": 730 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let derive_sealing_retain_context =
2uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.derive_sealing_label
val derive_sealing_label : FStar.UInt64.t
let derive_sealing_label = 4uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 30, "end_line": 734, "start_col": 0, "start_line": 734 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let derive_sealing_label =
4uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.unseal_output_args
val unseal_output_args : CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
let unseal_output_args = Cddl.t_map unseal_output_args_group
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 77, "end_line": 723, "start_col": 17, "start_line": 723 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_map", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "DPE.Messages.Spec.unseal_output_args_group" ]
[]
false
false
false
true
false
let unseal_output_args =
Cddl.t_map unseal_output_args_group
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.derive_sealing_context_handle
val derive_sealing_context_handle : FStar.UInt64.t
let derive_sealing_context_handle = 1uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 39, "end_line": 728, "start_col": 0, "start_line": 728 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let derive_sealing_context_handle =
1uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.unseal_new_context_handle
val unseal_new_context_handle : FStar.UInt64.t
let unseal_new_context_handle = 2uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 35, "end_line": 710, "start_col": 0, "start_line": 710 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let unseal_new_context_handle =
2uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.derive_sealing_input_args_group
val derive_sealing_input_args_group : CDDL.Spec.map_group FStar.Pervasives.Native.None
let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 4, "end_line": 742, "start_col": 0, "start_line": 736 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.map_group FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.map_group_cons_zero_or_one", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "CDDL.Spec.MapGroupEntry", "CDDL.Spec.t_uint_literal", "DPE.Messages.Spec.derive_sealing_context_handle", "CDDL.Spec.bytes", "DPE.Messages.Spec.derive_sealing_retain_context", "CDDL.Spec.t_bool", "DPE.Messages.Spec.derive_sealing_unseal_policy", "DPE.Messages.Spec.derive_sealing_label", "DPE.Messages.Spec.default_args_group" ]
[]
false
false
false
true
false
let derive_sealing_input_args_group =
Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal derive_sealing_context_handle) Cddl.bytes) false (Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal derive_sealing_retain_context) Cddl.t_bool) false (Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal derive_sealing_unseal_policy) Cddl.bytes) false (Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal derive_sealing_label) Cddl.bytes) false (default_args_group))))
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.derive_sealing_input_args
val derive_sealing_input_args : CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 90, "end_line": 749, "start_col": 16, "start_line": 749 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_map", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "DPE.Messages.Spec.derive_sealing_input_args_group" ]
[]
false
false
false
true
false
let derive_sealing_input_args =
Cddl.t_map derive_sealing_input_args_group
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.derive_sealing_derived_public_key
val derive_sealing_derived_public_key : FStar.UInt64.t
let derive_sealing_derived_public_key = 1uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 43, "end_line": 752, "start_col": 0, "start_line": 752 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let derive_sealing_derived_public_key =
1uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.rotate_context_handle_input_args
val rotate_context_handle_input_args : CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 104, "end_line": 784, "start_col": 16, "start_line": 784 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_map", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "DPE.Messages.Spec.rotate_context_handle_input_args_group" ]
[]
false
false
false
true
false
let rotate_context_handle_input_args =
Cddl.t_map rotate_context_handle_input_args_group
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.derive_sealing_output_args
val derive_sealing_output_args : CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 93, "end_line": 767, "start_col": 17, "start_line": 767 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_map", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "DPE.Messages.Spec.derive_sealing_output_args_group" ]
[]
false
false
false
true
false
let derive_sealing_output_args =
Cddl.t_map derive_sealing_output_args_group
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.rotate_context_handle_context_handle
val rotate_context_handle_context_handle : FStar.UInt64.t
let rotate_context_handle_context_handle = 1uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 46, "end_line": 772, "start_col": 0, "start_line": 772 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let rotate_context_handle_context_handle =
1uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.derive_sealing_new_context_handle
val derive_sealing_new_context_handle : FStar.UInt64.t
let derive_sealing_new_context_handle = 2uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 43, "end_line": 754, "start_col": 0, "start_line": 754 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let derive_sealing_new_context_handle =
2uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.rotate_context_handle_input_args_group
val rotate_context_handle_input_args_group : CDDL.Spec.map_group FStar.Pervasives.Native.None
let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 1, "end_line": 777, "start_col": 0, "start_line": 774 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.map_group FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.map_group_cons_zero_or_one", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "CDDL.Spec.MapGroupEntry", "CDDL.Spec.t_uint_literal", "DPE.Messages.Spec.rotate_context_handle_context_handle", "CDDL.Spec.bytes", "DPE.Messages.Spec.default_args_group" ]
[]
false
false
false
true
false
let rotate_context_handle_input_args_group =
Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal rotate_context_handle_context_handle) Cddl.bytes) false (default_args_group)
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.rotate_context_handle_output_args
val rotate_context_handle_output_args : CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
let rotate_context_handle_output_args = Cddl.t_map rotate_context_handle_output_args_group
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 107, "end_line": 799, "start_col": 17, "start_line": 799 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_output_args_group #pop-options
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_map", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "DPE.Messages.Spec.rotate_context_handle_output_args_group" ]
[]
false
false
false
true
false
let rotate_context_handle_output_args =
Cddl.t_map rotate_context_handle_output_args_group
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.destroy_context_input_args
val destroy_context_input_args : CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
let destroy_context_input_args = Cddl.t_map destroy_context_input_args_group
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 92, "end_line": 816, "start_col": 16, "start_line": 816 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_output_args_group #pop-options [@@_output_args] let rotate_context_handle_output_args = Cddl.t_map rotate_context_handle_output_args_group // Section 6.15 [@@CMacro] let destroy_context_context_handle = 1uL let destroy_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal destroy_context_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (destroy_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv destroy_context_input_args_group #pop-options
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_map", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "DPE.Messages.Spec.destroy_context_input_args_group" ]
[]
false
false
false
true
false
let destroy_context_input_args =
Cddl.t_map destroy_context_input_args_group
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.rotate_context_handle_output_args_group
val rotate_context_handle_output_args_group : CDDL.Spec.map_group FStar.Pervasives.Native.None
let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 1, "end_line": 792, "start_col": 0, "start_line": 789 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.map_group FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.map_group_cons_zero_or_one", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "CDDL.Spec.MapGroupEntry", "CDDL.Spec.t_uint_literal", "DPE.Messages.Spec.rotate_context_handle_new_context_handle", "CDDL.Spec.bytes", "DPE.Messages.Spec.default_args_group" ]
[]
false
false
false
true
false
let rotate_context_handle_output_args_group =
Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal rotate_context_handle_new_context_handle) Cddl.bytes) false (default_args_group)
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.rotate_context_handle_new_context_handle
val rotate_context_handle_new_context_handle : FStar.UInt64.t
let rotate_context_handle_new_context_handle = 2uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 50, "end_line": 787, "start_col": 0, "start_line": 787 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let rotate_context_handle_new_context_handle =
2uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.destroy_context_context_handle
val destroy_context_context_handle : FStar.UInt64.t
let destroy_context_context_handle = 1uL
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 40, "end_line": 804, "start_col": 0, "start_line": 804 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_output_args_group #pop-options [@@_output_args] let rotate_context_handle_output_args = Cddl.t_map rotate_context_handle_output_args_group // Section 6.15
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
FStar.UInt64.t
Prims.Tot
[ "total" ]
[]
[ "FStar.UInt64.__uint_to_t" ]
[]
false
false
false
true
false
let destroy_context_context_handle =
1uL
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.derive_sealing_output_args_group
val derive_sealing_output_args_group : CDDL.Spec.map_group FStar.Pervasives.Native.None
let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 2, "end_line": 760, "start_col": 0, "start_line": 756 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.map_group FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.map_group_cons_zero_or_one", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "CDDL.Spec.MapGroupEntry", "CDDL.Spec.t_uint_literal", "DPE.Messages.Spec.derive_sealing_derived_public_key", "CDDL.Spec.bytes", "DPE.Messages.Spec.derive_sealing_new_context_handle", "DPE.Messages.Spec.default_args_group" ]
[]
false
false
false
true
false
let derive_sealing_output_args_group =
Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal derive_sealing_derived_public_key) Cddl.bytes) false (Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal derive_sealing_new_context_handle) Cddl.bytes) false (default_args_group))
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.destroy_context_input_args_group
val destroy_context_input_args_group : CDDL.Spec.map_group FStar.Pervasives.Native.None
let destroy_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal destroy_context_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 1, "end_line": 809, "start_col": 0, "start_line": 806 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_output_args_group #pop-options [@@_output_args] let rotate_context_handle_output_args = Cddl.t_map rotate_context_handle_output_args_group // Section 6.15 [@@CMacro] let destroy_context_context_handle = 1uL
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.map_group FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.map_group_cons_zero_or_one", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "CDDL.Spec.MapGroupEntry", "CDDL.Spec.t_uint_literal", "DPE.Messages.Spec.destroy_context_context_handle", "CDDL.Spec.bytes", "DPE.Messages.Spec.default_args_group" ]
[]
false
false
false
true
false
let destroy_context_input_args_group =
Cddl.map_group_cons_zero_or_one (Cddl.MapGroupEntry (Cddl.t_uint_literal destroy_context_context_handle) Cddl.bytes) false (default_args_group)
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.create_choice_from
val create_choice_from (attr: T.term) : T.Tac unit
val create_choice_from (attr: T.term) : T.Tac unit
let create_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ t; accu; ] ))
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 4, "end_line": 829, "start_col": 0, "start_line": 823 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_output_args_group #pop-options [@@_output_args] let rotate_context_handle_output_args = Cddl.t_map rotate_context_handle_output_args_group // Section 6.15 [@@CMacro] let destroy_context_context_handle = 1uL let destroy_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal destroy_context_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (destroy_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv destroy_context_input_args_group #pop-options [@@_input_args] let destroy_context_input_args = Cddl.t_map destroy_context_input_args_group [@@_output_args] let destroy_context_output_args = Cddl.t_map default_args_group // Section 5.9.4: summary
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
attr: FStar.Stubs.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.unit
FStar.Tactics.Effect.Tac
[]
[]
[ "FStar.Stubs.Reflection.Types.term", "FStar.Tactics.V1.Derived.exact", "Prims.unit", "DPE.Messages.Spec.t_create_choice_from_gen", "FStar.Reflection.V1.Derived.mk_e_app", "Prims.Cons", "Prims.Nil" ]
[]
false
true
false
false
false
let create_choice_from (attr: T.term) : T.Tac unit =
T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [t; accu]))
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.output_args
val output_args:Cddl.typ
val output_args:Cddl.typ
let output_args : Cddl.typ = _ by (create_choice_from (`_output_args))
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 70, "end_line": 832, "start_col": 0, "start_line": 832 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_output_args_group #pop-options [@@_output_args] let rotate_context_handle_output_args = Cddl.t_map rotate_context_handle_output_args_group // Section 6.15 [@@CMacro] let destroy_context_context_handle = 1uL let destroy_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal destroy_context_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (destroy_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv destroy_context_input_args_group #pop-options [@@_input_args] let destroy_context_input_args = Cddl.t_map destroy_context_input_args_group [@@_output_args] let destroy_context_output_args = Cddl.t_map default_args_group // Section 5.9.4: summary [@@noextract_to "krml"] let create_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ t; accu; ] ))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.typ
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_choice", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "DPE.Messages.Spec.get_profile_output_args", "DPE.Messages.Spec.open_session_output_args", "DPE.Messages.Spec.close_session_output_args", "DPE.Messages.Spec.sync_session_output_args", "DPE.Messages.Spec.export_session_output_args", "DPE.Messages.Spec.import_session_output_args", "DPE.Messages.Spec.initialize_context_output_args", "DPE.Messages.Spec.derive_child_output_args", "DPE.Messages.Spec.certify_key_output_args", "DPE.Messages.Spec.sign_output_args", "DPE.Messages.Spec.seal_output_args", "DPE.Messages.Spec.unseal_output_args", "DPE.Messages.Spec.derive_sealing_output_args", "DPE.Messages.Spec.rotate_context_handle_output_args", "DPE.Messages.Spec.destroy_context_output_args", "CDDL.Spec.t_always_false" ]
[]
false
false
false
true
false
let output_args:Cddl.typ =
FStar.Tactics.Effect.synth_by_tactic (fun _ -> (create_choice_from (`_output_args)))
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.response_message'
val response_message' : CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
let response_message' = Cddl.t_array3 ( Cddl.array_group3_item error_code `Cddl.array_group3_concat` Cddl.array_group3_item (Cddl.t_map default_args_group) )
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 1, "end_line": 863, "start_col": 0, "start_line": 860 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_output_args_group #pop-options [@@_output_args] let rotate_context_handle_output_args = Cddl.t_map rotate_context_handle_output_args_group // Section 6.15 [@@CMacro] let destroy_context_context_handle = 1uL let destroy_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal destroy_context_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (destroy_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv destroy_context_input_args_group #pop-options [@@_input_args] let destroy_context_input_args = Cddl.t_map destroy_context_input_args_group [@@_output_args] let destroy_context_output_args = Cddl.t_map default_args_group // Section 5.9.4: summary [@@noextract_to "krml"] let create_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ t; accu; ] )) let input_args : Cddl.typ = _ by (create_choice_from (`_input_args)) let output_args : Cddl.typ = _ by (create_choice_from (`_output_args)) #push-options "--z3rlimit 64" #restart-solver let _ : squash (input_args `Cddl.typ_equiv` Cddl.t_map default_args_group) = () let _ : squash (output_args `Cddl.typ_equiv` Cddl.t_map default_args_group) = () #pop-options let command_message = Cddl.t_array3 ( Cddl.array_group3_item (* command_id *) command_id `Cddl.array_group3_concat` Cddl.array_group3_item (* input_args *) input_args ) let command_message' = Cddl.t_array3 ( Cddl.array_group3_item command_id `Cddl.array_group3_concat` Cddl.array_group3_item (Cddl.t_map default_args_group) ) #push-options "--z3rlimit 32" #restart-solver let _ : squash (command_message `Cddl.typ_equiv` command_message') = () #pop-options let response_message = Cddl.t_array3 ( Cddl.array_group3_item (* error_code *) error_code `Cddl.array_group3_concat` Cddl.array_group3_item (* output_args *) output_args )
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_array3", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "CDDL.Spec.array_group3_concat", "CDDL.Spec.array_group3_item", "DPE.Messages.Spec.error_code", "CDDL.Spec.t_map", "DPE.Messages.Spec.default_args_group" ]
[]
false
false
false
true
false
let response_message' =
Cddl.t_array3 ((Cddl.array_group3_item error_code) `Cddl.array_group3_concat` (Cddl.array_group3_item (Cddl.t_map default_args_group)))
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.destroy_context_output_args
val destroy_context_output_args : CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
let destroy_context_output_args = Cddl.t_map default_args_group
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 80, "end_line": 818, "start_col": 17, "start_line": 818 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_output_args_group #pop-options [@@_output_args] let rotate_context_handle_output_args = Cddl.t_map rotate_context_handle_output_args_group // Section 6.15 [@@CMacro] let destroy_context_context_handle = 1uL let destroy_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal destroy_context_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (destroy_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv destroy_context_input_args_group #pop-options [@@_input_args] let destroy_context_input_args = Cddl.t_map destroy_context_input_args_group
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_map", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "DPE.Messages.Spec.default_args_group" ]
[]
false
false
false
true
false
let destroy_context_output_args =
Cddl.t_map default_args_group
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.command_message
val command_message : CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
let command_message = Cddl.t_array3 ( Cddl.array_group3_item (* command_id *) command_id `Cddl.array_group3_concat` Cddl.array_group3_item (* input_args *) input_args )
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 1, "end_line": 843, "start_col": 0, "start_line": 840 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_output_args_group #pop-options [@@_output_args] let rotate_context_handle_output_args = Cddl.t_map rotate_context_handle_output_args_group // Section 6.15 [@@CMacro] let destroy_context_context_handle = 1uL let destroy_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal destroy_context_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (destroy_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv destroy_context_input_args_group #pop-options [@@_input_args] let destroy_context_input_args = Cddl.t_map destroy_context_input_args_group [@@_output_args] let destroy_context_output_args = Cddl.t_map default_args_group // Section 5.9.4: summary [@@noextract_to "krml"] let create_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ t; accu; ] )) let input_args : Cddl.typ = _ by (create_choice_from (`_input_args)) let output_args : Cddl.typ = _ by (create_choice_from (`_output_args)) #push-options "--z3rlimit 64" #restart-solver let _ : squash (input_args `Cddl.typ_equiv` Cddl.t_map default_args_group) = () let _ : squash (output_args `Cddl.typ_equiv` Cddl.t_map default_args_group) = () #pop-options
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_array3", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "CDDL.Spec.array_group3_concat", "CDDL.Spec.array_group3_item", "DPE.Messages.Spec.command_id", "DPE.Messages.Spec.input_args" ]
[]
false
false
false
true
false
let command_message =
Cddl.t_array3 ((Cddl.array_group3_item command_id) `Cddl.array_group3_concat` (Cddl.array_group3_item input_args))
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.input_args
val input_args:Cddl.typ
val input_args:Cddl.typ
let input_args : Cddl.typ = _ by (create_choice_from (`_input_args))
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 68, "end_line": 831, "start_col": 0, "start_line": 831 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_output_args_group #pop-options [@@_output_args] let rotate_context_handle_output_args = Cddl.t_map rotate_context_handle_output_args_group // Section 6.15 [@@CMacro] let destroy_context_context_handle = 1uL let destroy_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal destroy_context_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (destroy_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv destroy_context_input_args_group #pop-options [@@_input_args] let destroy_context_input_args = Cddl.t_map destroy_context_input_args_group [@@_output_args] let destroy_context_output_args = Cddl.t_map default_args_group // Section 5.9.4: summary [@@noextract_to "krml"] let create_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ t; accu; ] ))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.typ
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_choice", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "DPE.Messages.Spec.get_profile_input_args", "DPE.Messages.Spec.open_session_input_args", "DPE.Messages.Spec.close_session_input_args", "DPE.Messages.Spec.sync_session_input_args", "DPE.Messages.Spec.export_session_input_args", "DPE.Messages.Spec.import_session_input_args", "DPE.Messages.Spec.initialize_context_input_args", "DPE.Messages.Spec.derive_child_input_args", "DPE.Messages.Spec.certify_key_input_args", "DPE.Messages.Spec.sign_input_args", "DPE.Messages.Spec.seal_input_args", "DPE.Messages.Spec.unseal_input_args", "DPE.Messages.Spec.derive_sealing_input_args", "DPE.Messages.Spec.rotate_context_handle_input_args", "DPE.Messages.Spec.destroy_context_input_args", "CDDL.Spec.t_always_false" ]
[]
false
false
false
true
false
let input_args:Cddl.typ =
FStar.Tactics.Effect.synth_by_tactic (fun _ -> (create_choice_from (`_input_args)))
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.command_message'
val command_message' : CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
let command_message' = Cddl.t_array3 ( Cddl.array_group3_item command_id `Cddl.array_group3_concat` Cddl.array_group3_item (Cddl.t_map default_args_group) )
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 1, "end_line": 848, "start_col": 0, "start_line": 845 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_output_args_group #pop-options [@@_output_args] let rotate_context_handle_output_args = Cddl.t_map rotate_context_handle_output_args_group // Section 6.15 [@@CMacro] let destroy_context_context_handle = 1uL let destroy_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal destroy_context_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (destroy_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv destroy_context_input_args_group #pop-options [@@_input_args] let destroy_context_input_args = Cddl.t_map destroy_context_input_args_group [@@_output_args] let destroy_context_output_args = Cddl.t_map default_args_group // Section 5.9.4: summary [@@noextract_to "krml"] let create_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ t; accu; ] )) let input_args : Cddl.typ = _ by (create_choice_from (`_input_args)) let output_args : Cddl.typ = _ by (create_choice_from (`_output_args)) #push-options "--z3rlimit 64" #restart-solver let _ : squash (input_args `Cddl.typ_equiv` Cddl.t_map default_args_group) = () let _ : squash (output_args `Cddl.typ_equiv` Cddl.t_map default_args_group) = () #pop-options let command_message = Cddl.t_array3 ( Cddl.array_group3_item (* command_id *) command_id `Cddl.array_group3_concat` Cddl.array_group3_item (* input_args *) input_args )
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_array3", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "CDDL.Spec.array_group3_concat", "CDDL.Spec.array_group3_item", "DPE.Messages.Spec.command_id", "CDDL.Spec.t_map", "DPE.Messages.Spec.default_args_group" ]
[]
false
false
false
true
false
let command_message' =
Cddl.t_array3 ((Cddl.array_group3_item command_id) `Cddl.array_group3_concat` (Cddl.array_group3_item (Cddl.t_map default_args_group)))
false
DPE.Messages.Spec.fst
DPE.Messages.Spec.response_message
val response_message : CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
let response_message = Cddl.t_array3 ( Cddl.array_group3_item (* error_code *) error_code `Cddl.array_group3_concat` Cddl.array_group3_item (* output_args *) output_args )
{ "file_name": "share/steel/examples/pulse/dice/dpe/DPE.Messages.Spec.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 1, "end_line": 858, "start_col": 0, "start_line": 855 }
(* 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 DPE.Messages.Spec module Cddl = CDDL.Spec module Cbor = CBOR.Spec module U64 = FStar.UInt64 module U8 = FStar.UInt8 (* TCG DICE Protection Engine, Version 1.0, Revision 0.6 *) // Section 5.9.2: DPE uses CBOR (RFC 8949) Section 4.2.1 let data_item_order = Cbor.deterministically_encoded_cbor_map_key_order // Section 5.9.3 let session_message : Cddl.typ = Cddl.t_array3 ( Cddl.array_group3_item (* session-id *) Cddl.uint `Cddl.array_group3_concat` Cddl.array_group3_item (* message *) Cddl.bytes ) // Section 5.9.4 [@@CMacro] let get_profile = 1uL [@@CMacro] let open_session = 2uL [@@CMacro] let close_session = 3uL [@@CMacro] let sync_session = 4uL [@@CMacro] let export_session = 5uL [@@CMacro] let import_session = 6uL [@@CMacro] let initialize_context = 7uL [@@CMacro] let derive_child = 8uL [@@CMacro] let certify_key = 9uL [@@CMacro] let sign = 10uL [@@CMacro] let seal = 11uL [@@CMacro] let unseal = 12uL [@@CMacro] let derive_sealing_public_key = 13uL [@@CMacro] let rotate_context_handle = 14uL [@@CMacro] let destroy_context = 15uL let command_id = Cddl.t_uint_literal get_profile `Cddl.t_choice` Cddl.t_uint_literal open_session `Cddl.t_choice` Cddl.t_uint_literal close_session `Cddl.t_choice` Cddl.t_uint_literal sync_session `Cddl.t_choice` Cddl.t_uint_literal export_session `Cddl.t_choice` Cddl.t_uint_literal import_session `Cddl.t_choice` Cddl.t_uint_literal initialize_context `Cddl.t_choice` Cddl.t_uint_literal derive_child `Cddl.t_choice` Cddl.t_uint_literal certify_key `Cddl.t_choice` Cddl.t_uint_literal sign `Cddl.t_choice` Cddl.t_uint_literal seal `Cddl.t_choice` Cddl.t_uint_literal unseal `Cddl.t_choice` Cddl.t_uint_literal derive_sealing_public_key `Cddl.t_choice` Cddl.t_uint_literal rotate_context_handle `Cddl.t_choice` Cddl.t_uint_literal destroy_context [@@CMacro] let no_error = 0uL [@@CMacro] let internal_error = 1uL [@@CMacro] let invalid_command = 2uL [@@CMacro] let invalid_argument = 3uL [@@CMacro] let argument_not_supported = 4uL [@@CMacro] let session_exhausted = 5uL let error_code = Cddl.t_uint_literal no_error `Cddl.t_choice` Cddl.t_uint_literal internal_error `Cddl.t_choice` Cddl.t_uint_literal invalid_command `Cddl.t_choice` Cddl.t_uint_literal invalid_argument `Cddl.t_choice` Cddl.t_uint_literal argument_not_supported `Cddl.t_choice` Cddl.t_uint_literal session_exhausted let _input_args = () let _output_args = () // Section 7.4 let _pd_attribute_bool = () let _pd_attribute_number = () let _pd_attribute_string = () [@@_pd_attribute_string; CMacro] let pd_name = 1uL [@@_pd_attribute_number; CMacro] let pd_dpe_spec_version = 2uL [@@_pd_attribute_number; CMacro] let pd_max_message_size = 3uL [@@_pd_attribute_bool; CMacro] let pd_uses_multi_part_messaghes = 4uL [@@_pd_attribute_bool; CMacro] let pd_supports_concurrent_operations = 5uL [@@_pd_attribute_bool; CMacro] let pd_supports_encrypted_sessions = 6uL [@@_pd_attribute_bool; CMacro] let pd_supports_derived_sessions = 7uL [@@_pd_attribute_number; CMacro] let pd_max_sessions = 8uL [@@_pd_attribute_string; CMacro] let pd_session_protocol = 9uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_sync = 10uL [@@_pd_attribute_string; CMacro] let pd_session_sync_policy = 11uL [@@_pd_attribute_bool; CMacro] let pd_supports_session_migration = 12uL [@@_pd_attribute_string; CMacro] let pd_session_migration_protocol = 13uL [@@_pd_attribute_bool; CMacro] let pd_supports_default_context = 14uL [@@_pd_attribute_bool; CMacro] let pd_supports_context_handles = 15uL [@@_pd_attribute_number; CMacro] let pd_max_contexts_per_session = 16uL [@@_pd_attribute_number; CMacro] let pd_max_context_handle_size = 17uL [@@_pd_attribute_bool; CMacro] let pd_supports_auto_init = 18uL [@@_pd_attribute_bool; CMacro] let pd_supports_simulation = 19uL [@@_pd_attribute_bool; CMacro] let pd_supports_attestation = 20uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing = 21uL [@@_pd_attribute_bool; CMacro] let pd_supports_get_profile = 22uL [@@_pd_attribute_bool; CMacro] let pd_supports_open_session = 23uL [@@_pd_attribute_bool; CMacro] let pd_supports_close_session = 24uL [@@_pd_attribute_bool; CMacro] let pd_supports_sync_session = 25uL [@@_pd_attribute_bool; CMacro] let pd_supports_export_session = 26uL [@@_pd_attribute_bool; CMacro] let pd_supports_import_session = 27uL [@@_pd_attribute_bool; CMacro] let pd_supports_init_context = 28uL [@@_pd_attribute_bool; CMacro] let pd_supports_certify_key = 29uL [@@_pd_attribute_bool; CMacro] let pd_supports_sign = 30uL [@@_pd_attribute_bool; CMacro] let pd_supports_seal = 31uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal = 32uL [@@_pd_attribute_bool; CMacro] let pd_supports_sealing_public = 33uL [@@_pd_attribute_bool; CMacro] let pd_supports_rotate_context_handle = 34uL [@@_pd_attribute_string; CMacro] let pd_dice_derivation = 35uL [@@_pd_attribute_string; CMacro] let pd_asymmetric_derivation = 36uL [@@_pd_attribute_string; CMacro] let pd_symmetric_derivation = 37uL [@@_pd_attribute_bool; CMacro] let pd_supports_any_label = 38uL [@@_pd_attribute_string; CMacro] let pd_supported_labels = 39uL [@@_pd_attribute_string; CMacro] let pd_initial_derivation = 40uL [@@_pd_attribute_string; CMacro] let pd_input_format = 41uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_inputs = 42uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_info = 43uL [@@_pd_attribute_bool; CMacro] let pd_supports_internal_dpe_dice = 44uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_info_type = 45uL [@@_pd_attribute_string; CMacro] let pd_internal_dpe_dice_type = 46uL [@@_pd_attribute_string; CMacro] let pd_internal_inputs = 47uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificates = 48uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_size = 49uL [@@_pd_attribute_number; CMacro] let pd_max_certificate_chain_size = 50uL [@@_pd_attribute_bool; CMacro] let pd_appends_more_certificates = 51uL [@@_pd_attribute_bool; CMacro] let pd_supports_certificate_policies = 52uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_init = 53uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_identity_loc = 54uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_init = 55uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_attest_loc = 56uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_init = 57uL [@@_pd_attribute_bool; CMacro] let pd_supports_policy_assert_loc = 58uL [@@_pd_attribute_string; CMacro] let pd_certificate_policies = 59uL [@@_pd_attribute_bool; CMacro] let pd_supports_eca_certificates = 60uL [@@_pd_attribute_string; CMacro] let pd_eca_certificate_format = 61uL [@@_pd_attribute_string; CMacro] let pd_leaf_certificate_format = 62uL [@@_pd_attribute_string; CMacro] let pd_public_key_format = 63uL [@@_pd_attribute_bool; CMacro] let pd_supports_external_key = 64uL [@@_pd_attribute_string; CMacro] let pd_to_be_signed_format = 65uL [@@_pd_attribute_string; CMacro] let pd_signature_format = 66uL [@@_pd_attribute_bool; CMacro] let pd_supports_symmetric_sign = 67uL [@@_pd_attribute_bool; CMacro] let pd_supports_asymmetric_unseal = 68uL [@@_pd_attribute_bool; CMacro] let pd_supports_unseal_policy = 69uL [@@_pd_attribute_string; CMacro] let pd_unseal_policy_format = 70uL module T = FStar.Tactics [@@noextract_to "krml"] let t_create_choice_from_gen (attr: T.term) (f: T.term -> T.term -> T.term) : T.Tac T.term = let e = T.cur_env () in let l = T.lookup_attr attr e in let rec aux (accu: T.term) (l: list T.fv) : T.Tac T.term = match l with | [] -> accu | v :: l' -> let accu' = f accu (T.pack (T.Tv_FVar v)) in aux accu' l' in aux (`Cddl.t_always_false) l [@@noextract_to "krml"] let create_uint_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ T.mk_e_app (`Cddl.t_uint_literal) [ t ]; accu; ] )) let pd_attribute_bool : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_bool)) let pd_attribute_number : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_number)) let pd_attribute_string : Cddl.typ = _ by (create_uint_choice_from (`_pd_attribute_string)) let profile_descriptor : Cddl.typ = Cddl.t_map ( Cddl.map_group_cons_zero_or_more (pd_attribute_bool `Cddl.MapGroupEntry` Cddl.t_bool) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_number `Cddl.MapGroupEntry` Cddl.uint) false (* FIXME: really? *) ( Cddl.map_group_cons_zero_or_more (pd_attribute_string `Cddl.MapGroupEntry` Cddl.tstr) false (* FIXME: really? *) ( Cddl.map_group_empty )))) // Section 6.1 let default_args_group = Cddl.map_group_cons_zero_or_more (Cddl.uint `Cddl.MapGroupEntry` Cddl.any) false Cddl.map_group_empty [@@_input_args] let get_profile_input_args : Cddl.typ = Cddl.t_map ( default_args_group ) [@@CMacro] let get_profile_profile_descriptor = 1uL let get_profile_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal get_profile_profile_descriptor `Cddl.MapGroupEntry` profile_descriptor) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (get_profile_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv get_profile_output_args_group #pop-options [@@_output_args] let get_profile_output_args : Cddl.typ = Cddl.t_map ( get_profile_output_args_group ) // Section 6.2 [@@CMacro] let open_session_initiator_handshake = 1uL [@@CMacro] let open_session_is_migratable = 2uL let open_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (open_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_input_args_group #pop-options [@@_input_args] let open_session_input_args = Cddl.t_map open_session_input_args_group [@@CMacro] let open_session_responder_handshake = 1uL let open_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal open_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (open_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv open_session_output_args_group #pop-options [@@_output_args] let open_session_output_args = Cddl.t_map open_session_output_args_group let responder_handshake_payload = Cddl.uint // Section 6.3 [@@_input_args] let close_session_input_args = Cddl.t_map default_args_group [@@_output_args] let close_session_output_args = Cddl.t_map default_args_group // Section 6.4 [@@CMacro] let sync_session_session_id = 1uL [@@CMacro] let sync_session_initiator_counter = 2uL let sync_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_initiator_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sync_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_input_args_group #pop-options [@@_input_args] let sync_session_input_args = Cddl.t_map sync_session_input_args_group [@@CMacro] let sync_session_responder_counter = 1uL let sync_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sync_session_responder_counter `Cddl.MapGroupEntry` Cddl.uint) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (sync_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sync_session_output_args_group #pop-options [@@_output_args] let sync_session_output_args = Cddl.t_map sync_session_output_args_group // Section 6.5 [@@CMacro] let export_session_session_id = 1uL [@@CMacro] let export_session_importer_identity = 2uL [@@CMacro] let export_session_psk = 3uL let export_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_session_id `Cddl.MapGroupEntry` Cddl.uint) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (export_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_input_args_group #pop-options [@@_input_args] let export_session_input_args = Cddl.t_map export_session_input_args_group [@@CMacro] let export_session_exported_data = 1uL let export_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal export_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (export_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv export_session_output_args_group #pop-options [@@_output_args] let export_session_output_args = Cddl.t_map export_session_output_args_group // Section 6.6 [@@CMacro] let import_session_context_handle = 1uL [@@CMacro] let import_session_retain_context = 2uL [@@CMacro] let import_session_exported_data = 3uL [@@CMacro] let import_session_psk = 4uL let import_session_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_exported_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_psk `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (import_session_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_input_args_group #pop-options [@@_input_args] let import_session_input_args = Cddl.t_map import_session_input_args_group [@@CMacro] let import_session_importer_identity = 1uL [@@CMacro] let import_session_new_context_handle = 2uL let import_session_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_importer_identity `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal import_session_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (import_session_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv import_session_output_args_group #pop-options [@@_output_args] let import_session_output_args = Cddl.t_map import_session_output_args_group // Section 6.7 [@@CMacro] let initialize_context_simulation = 1uL [@@CMacro] let initialize_context_use_default_context = 2uL [@@CMacro] let initialize_context_seed = 3uL let initialize_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_simulation `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_use_default_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_seed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (initialize_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_input_args_group #pop-options [@@_input_args] let initialize_context_input_args = Cddl.t_map initialize_context_input_args_group [@@CMacro] let initialize_context_new_context_handle = 1uL let initialize_context_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal initialize_context_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (initialize_context_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv initialize_context_output_args_group #pop-options [@@_output_args] let initialize_context_output_args = Cddl.t_map initialize_context_output_args_group // Section 6.8 [@@CMacro] let derive_child_context_handle = 1uL [@@CMacro] let derive_child_retain_parent_context = 2uL [@@CMacro] let derive_child_allow_child_to_derive = 3uL [@@CMacro] let derive_child_create_certificate = 4uL [@@CMacro] let derive_child_new_session_initiator_handshake = 5uL [@@CMacro] let derive_child_new_session_is_migratable = 6uL [@@CMacro] let derive_child_input_data = 7uL [@@CMacro] let derive_child_internal_inputs = 8uL [@@CMacro] let internal_input_type_dpe_info = 1uL [@@CMacro] let internal_input_type_dpe_dice = 2uL let internal_input_type = Cddl.t_uint_literal internal_input_type_dpe_info `Cddl.t_choice` Cddl.t_uint_literal internal_input_type_dpe_dice let derive_child_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_retain_parent_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_allow_child_to_derive `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_create_certificate `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_initiator_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_is_migratable `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_input_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_internal_inputs `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item internal_input_type))) false ( default_args_group )))))))) #push-options "--z3rlimit 32 --fuel 10" let _ : squash (derive_child_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_input_args_group #pop-options [@@_input_args] let derive_child_input_args = Cddl.t_map derive_child_input_args_group [@@CMacro] let derive_child_new_context_handle = 1uL [@@CMacro] let derive_child_new_session_responder_handshake = 2uL [@@CMacro] let derive_child_parent_context_handle = 3uL let derive_child_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_new_session_responder_handshake `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_child_parent_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (derive_child_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_child_output_args_group #pop-options [@@_output_args] let derive_child_output_args = Cddl.t_map derive_child_output_args_group // Section 6.9 [@@CMacro] let certify_key_context_handle = 1uL [@@CMacro] let certify_key_retain_context = 2uL [@@CMacro] let certify_key_public_key = 3uL [@@CMacro] let certify_key_label = 4uL [@@CMacro] let certify_key_policies = 5uL [@@CMacro] let tcg_dice_kp_identityInit = 6uL [@@CMacro] let tcg_dice_kp_identityLoc = 7uL [@@CMacro] let tcg_dice_kp_attestInit = 8uL [@@CMacro] let tcg_dice_kp_attestLoc = 9uL [@@CMacro] let tcg_dice_kp_assertInit = 10uL [@@CMacro] let tcg_dice_kp_assertLoc = 11uL let policy_type = Cddl.t_uint_literal tcg_dice_kp_identityInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_identityLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_attestLoc `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertInit `Cddl.t_choice` Cddl.t_uint_literal tcg_dice_kp_assertLoc let certify_key_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_policies `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_zero_or_more (Cddl.array_group3_item policy_type))) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (certify_key_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_input_args_group #pop-options [@@_input_args] let certify_key_input_args = Cddl.t_map certify_key_input_args_group [@@CMacro] let certify_key_certificate_chain = 1uL [@@CMacro] let certify_key_derived_public_key = 2uL [@@CMacro] let certify_key_new_context_handle = 3uL let certify_key_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_certificate_chain `Cddl.MapGroupEntry` Cddl.t_array3 (Cddl.array_group3_one_or_more (Cddl.array_group3_item Cddl.bytes))) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal certify_key_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))) #push-options "--z3rlimit 32" let _ : squash (certify_key_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv certify_key_output_args_group #pop-options [@@_output_args] let certify_key_output_args = Cddl.t_map certify_key_output_args_group // Section 6.10 [@@CMacro] let sign_context_handle = 1uL [@@CMacro] let sign_retain_context = 2uL [@@CMacro] let sign_label = 3uL [@@CMacro] let sign_is_symmetric = 4uL [@@CMacro] let sign_to_be_signed = 5uL let sign_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_is_symmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_to_be_signed `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (sign_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_input_args_group #pop-options [@@_input_args] let sign_input_args = Cddl.t_map sign_input_args_group [@@CMacro] let sign_signature = 1uL [@@CMacro] let sign_new_context_handle = 2uL let sign_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_signature `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal sign_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (sign_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv sign_output_args_group #pop-options [@@_output_args] let sign_output_args = Cddl.t_map sign_output_args_group // Section 6.11 [@@CMacro] let seal_context_handle = 1uL [@@CMacro] let seal_retain_context = 2uL [@@CMacro] let seal_unseal_policy = 3uL [@@CMacro] let seal_label = 4uL [@@CMacro] let seal_data_to_seal = 5uL let seal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_data_to_seal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (seal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_input_args_group #pop-options [@@_input_args] let seal_input_args = Cddl.t_map seal_input_args_group [@@CMacro] let seal_sealed_data = 1uL [@@CMacro] let seal_new_context_handle = 2uL let seal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_sealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal seal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (seal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv seal_output_args_group #pop-options [@@_output_args] let seal_output_args = Cddl.t_map seal_output_args_group // Section 6.12 [@@CMacro] let unseal_context_handle = 1uL [@@CMacro] let unseal_retain_context = 2uL [@@CMacro] let unseal_is_asymmetric = 3uL [@@CMacro] let unseal_label = 4uL [@@CMacro] let unseal_data_to_unseal = 5uL let unseal_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_is_asymmetric `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_label `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_data_to_unseal `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ))))) #push-options "--z3rlimit 32" let _ : squash (unseal_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_input_args_group #pop-options [@@_input_args] let unseal_input_args = Cddl.t_map unseal_input_args_group [@@CMacro] let unseal_unsealed_data = 1uL [@@CMacro] let unseal_new_context_handle = 2uL let unseal_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_unsealed_data `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal unseal_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (unseal_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv unseal_output_args_group #pop-options [@@_output_args] let unseal_output_args = Cddl.t_map unseal_output_args_group // Section 6.13 [@@CMacro] let derive_sealing_context_handle = 1uL [@@CMacro] let derive_sealing_retain_context = 2uL [@@CMacro] let derive_sealing_unseal_policy = 3uL [@@CMacro] let derive_sealing_label = 4uL let derive_sealing_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_retain_context `Cddl.MapGroupEntry` Cddl.t_bool) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_unseal_policy `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_label `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )))) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_input_args_group #pop-options [@@_input_args] let derive_sealing_input_args = Cddl.t_map derive_sealing_input_args_group [@@CMacro] let derive_sealing_derived_public_key = 1uL [@@CMacro] let derive_sealing_new_context_handle = 2uL let derive_sealing_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_derived_public_key `Cddl.MapGroupEntry` Cddl.bytes) false ( Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal derive_sealing_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group )) #push-options "--z3rlimit 32" let _ : squash (derive_sealing_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv derive_sealing_output_args_group #pop-options [@@_output_args] let derive_sealing_output_args = Cddl.t_map derive_sealing_output_args_group // Section 6.14 [@@CMacro] let rotate_context_handle_context_handle = 1uL let rotate_context_handle_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_input_args_group #pop-options [@@_input_args] let rotate_context_handle_input_args = Cddl.t_map rotate_context_handle_input_args_group [@@CMacro] let rotate_context_handle_new_context_handle = 2uL let rotate_context_handle_output_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal rotate_context_handle_new_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (rotate_context_handle_output_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv rotate_context_handle_output_args_group #pop-options [@@_output_args] let rotate_context_handle_output_args = Cddl.t_map rotate_context_handle_output_args_group // Section 6.15 [@@CMacro] let destroy_context_context_handle = 1uL let destroy_context_input_args_group = Cddl.map_group_cons_zero_or_one (Cddl.t_uint_literal destroy_context_context_handle `Cddl.MapGroupEntry` Cddl.bytes) false ( default_args_group ) #push-options "--z3rlimit 32" let _ : squash (destroy_context_input_args_group `Cddl.map_group_equiv` default_args_group) = Cddl.map_group_ignore_restricted_entries_no_one_equiv destroy_context_input_args_group #pop-options [@@_input_args] let destroy_context_input_args = Cddl.t_map destroy_context_input_args_group [@@_output_args] let destroy_context_output_args = Cddl.t_map default_args_group // Section 5.9.4: summary [@@noextract_to "krml"] let create_choice_from (attr: T.term) : T.Tac unit = T.exact (t_create_choice_from_gen attr (fun accu t -> T.mk_e_app (`Cddl.t_choice) [ t; accu; ] )) let input_args : Cddl.typ = _ by (create_choice_from (`_input_args)) let output_args : Cddl.typ = _ by (create_choice_from (`_output_args)) #push-options "--z3rlimit 64" #restart-solver let _ : squash (input_args `Cddl.typ_equiv` Cddl.t_map default_args_group) = () let _ : squash (output_args `Cddl.typ_equiv` Cddl.t_map default_args_group) = () #pop-options let command_message = Cddl.t_array3 ( Cddl.array_group3_item (* command_id *) command_id `Cddl.array_group3_concat` Cddl.array_group3_item (* input_args *) input_args ) let command_message' = Cddl.t_array3 ( Cddl.array_group3_item command_id `Cddl.array_group3_concat` Cddl.array_group3_item (Cddl.t_map default_args_group) ) #push-options "--z3rlimit 32" #restart-solver let _ : squash (command_message `Cddl.typ_equiv` command_message') = () #pop-options
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.Tactics.Effect.fsti.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "CDDL.Spec.fsti.checked", "CBOR.Spec.fsti.checked" ], "interface_file": false, "source_file": "DPE.Messages.Spec.fst" }
[ { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "CBOR.Spec", "short_module": "Cbor" }, { "abbrev": true, "full_module": "CDDL.Spec", "short_module": "Cddl" }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "DPE.Messages", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
CDDL.Spec.bounded_typ_gen FStar.Pervasives.Native.None
Prims.Tot
[ "total" ]
[]
[ "CDDL.Spec.t_array3", "FStar.Pervasives.Native.None", "CBOR.Spec.Type.raw_data_item", "CDDL.Spec.array_group3_concat", "CDDL.Spec.array_group3_item", "DPE.Messages.Spec.error_code", "DPE.Messages.Spec.output_args" ]
[]
false
false
false
true
false
let response_message =
Cddl.t_array3 ((Cddl.array_group3_item error_code) `Cddl.array_group3_concat` (Cddl.array_group3_item output_args))
false
Steel.Reference.fst
Steel.Reference.null
val null (#a:Type0) : ref a
val null (#a:Type0) : ref a
let null #a = H.null #(U.raise_t a)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 35, "end_line": 31, "start_col": 0, "start_line": 31 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
Steel.Reference.ref a
Prims.Tot
[ "total" ]
[]
[ "Steel.HigherReference.null", "FStar.Universe.raise_t", "Steel.Reference.ref" ]
[]
false
false
false
true
false
let null #a =
H.null #(U.raise_t a)
false
Steel.Reference.fst
Steel.Reference.ref
val ref ([@@@unused] a:Type0) : Type0
val ref ([@@@unused] a:Type0) : Type0
let ref a = H.ref (U.raise_t a)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 31, "end_line": 29, "start_col": 0, "start_line": 29 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off"
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: Type0 -> Type0
Prims.Tot
[ "total" ]
[]
[ "Steel.HigherReference.ref", "FStar.Universe.raise_t" ]
[]
false
false
false
true
true
let ref a =
H.ref (U.raise_t a)
false
Steel.Reference.fst
Steel.Reference.pts_to_sl
val pts_to_sl (#a:Type0) (r:ref a) (p:perm) (v:a) : slprop u#1
val pts_to_sl (#a:Type0) (r:ref a) (p:perm) (v:a) : slprop u#1
let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 53, "end_line": 34, "start_col": 0, "start_line": 34 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> v: a -> Steel.Memory.slprop
Prims.Tot
[ "total" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "Steel.HigherReference.pts_to_sl", "FStar.Universe.raise_t", "FStar.Universe.raise_val", "Steel.Memory.slprop" ]
[]
false
false
false
true
false
let pts_to_sl r p v =
H.pts_to_sl r p (U.raise_val v)
false
Steel.Reference.fst
Steel.Reference.raise_val_inj
val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y)
val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y)
let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 29, "end_line": 42, "start_col": 0, "start_line": 40 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: a -> y: a -> FStar.Pervasives.Lemma (requires FStar.Universe.raise_val x == FStar.Universe.raise_val y) (ensures x == y)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Universe.downgrade_val_raise_val", "Prims.unit" ]
[]
true
false
true
false
false
let raise_val_inj x y =
U.downgrade_val_raise_val x; U.downgrade_val_raise_val y
false
Steel.Reference.fst
Steel.Reference.pts_to_witinv
val pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p))
val pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p))
let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y))
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 73, "end_line": 88, "start_col": 0, "start_line": 81 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = ()
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> FStar.Pervasives.Lemma (ensures Steel.Memory.is_witness_invariant (Steel.Reference.pts_to_sl r p))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "FStar.Classical.forall_intro_3", "Steel.Memory.mem", "Prims.l_imp", "Prims.l_and", "Steel.Memory.interp", "Steel.Reference.pts_to_sl", "Prims.eq2", "FStar.Classical.move_requires", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern", "Steel.Reference.raise_val_inj", "Steel.HigherReference.pts_to_witinv", "FStar.Universe.raise_t", "Steel.Memory.is_witness_invariant" ]
[]
false
false
true
false
false
let pts_to_witinv (#a: Type) (r: ref a) (p: perm) : Lemma (is_witness_invariant (pts_to_sl r p)) =
let aux (x y: a) (m: mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y))
false
Steel.Reference.fst
Steel.Reference.hide_raise_reveal
val hide_raise_reveal (#a: Type) (v0 v1: erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))]
val hide_raise_reveal (#a: Type) (v0 v1: erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))]
let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 21, "end_line": 158, "start_col": 0, "start_line": 150 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ())
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
v0: FStar.Ghost.erased a -> v1: FStar.Ghost.erased a -> FStar.Pervasives.Lemma (ensures FStar.Ghost.hide (FStar.Universe.raise_val (FStar.Ghost.reveal v0)) == FStar.Ghost.hide (FStar.Universe.raise_val (FStar.Ghost.reveal v1)) <==> v0 == v1) [ SMTPat (FStar.Ghost.hide (FStar.Universe.raise_val (FStar.Ghost.reveal v0))); SMTPat (FStar.Ghost.hide (FStar.Universe.raise_val (FStar.Ghost.reveal v1))) ]
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Ghost.erased", "Prims._assert", "Prims.l_iff", "Prims.eq2", "FStar.Universe.downgrade_val", "FStar.Universe.raise_val", "FStar.Ghost.reveal", "FStar.Universe.raise_t", "FStar.Ghost.hide", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
true
false
true
false
false
let hide_raise_reveal (#a: Type) (v0 v1: erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] =
let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1)
false
Steel.Reference.fst
Steel.Reference.pts_to_ref_injective
val pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1)
val pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1)
let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 25, "end_line": 58, "start_col": 0, "start_line": 45 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p0: Steel.FractionalPermission.perm -> p1: Steel.FractionalPermission.perm -> v0: a -> v1: a -> m: Steel.Memory.mem -> FStar.Pervasives.Lemma (requires Steel.Memory.interp (Steel.Memory.star (Steel.Reference.pts_to_sl r p0 v0) (Steel.Reference.pts_to_sl r p1 v1)) m) (ensures v0 == v1)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "Steel.Memory.mem", "Steel.Reference.raise_val_inj", "Prims.unit", "Steel.HigherReference.pts_to_ref_injective", "FStar.Universe.raise_t", "FStar.Universe.raise_val", "Steel.Memory.interp", "Steel.Memory.star", "Steel.Reference.pts_to_sl", "Prims.squash", "Prims.eq2", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1: perm) (v0 v1: a) (m: mem) : Lemma (requires interp ((pts_to_sl r p0 v0) `Mem.star` (pts_to_sl r p1 v1)) m) (ensures v0 == v1) =
let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1
false
Steel.Reference.fst
Steel.Reference.is_null
val is_null (#a:Type0) (r:ref a) : (b:bool{b <==> r == null})
val is_null (#a:Type0) (r:ref a) : (b:bool{b <==> r == null})
let is_null #a r = H.is_null #(U.raise_t a) r
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 45, "end_line": 32, "start_col": 0, "start_line": 32 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> b: Prims.bool{b <==> r == Steel.Reference.null}
Prims.Tot
[ "total" ]
[]
[ "Steel.Reference.ref", "Steel.HigherReference.is_null", "FStar.Universe.raise_t", "Prims.bool", "Prims.l_iff", "Prims.b2t", "Prims.eq2", "Steel.Reference.null" ]
[]
false
false
false
false
false
let is_null #a r =
H.is_null #(U.raise_t a) r
false
Steel.Reference.fst
Steel.Reference.raise_equiv
val raise_equiv (#t: Type) (x y: t) : Lemma (U.raise_val x == U.raise_val y <==> x == y)
val raise_equiv (#t: Type) (x y: t) : Lemma (U.raise_val x == U.raise_val y <==> x == y)
let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 49, "end_line": 173, "start_col": 0, "start_line": 169 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: t -> y: t -> FStar.Pervasives.Lemma (ensures FStar.Universe.raise_val x == FStar.Universe.raise_val y <==> x == y)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Prims._assert", "Prims.eq2", "FStar.Universe.downgrade_val", "FStar.Universe.raise_val", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.l_iff", "FStar.Universe.raise_t", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let raise_equiv (#t: Type) (x y: t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) =
assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y)
false
Steel.Reference.fst
Steel.Reference.pts_to_not_null
val pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null)
val pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null)
let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 44, "end_line": 68, "start_col": 0, "start_line": 60 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> v: a -> m: Steel.Memory.mem -> FStar.Pervasives.Lemma (requires Steel.Memory.interp (Steel.Reference.pts_to_sl x p v) m) (ensures ~(x == Steel.Reference.null))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "Steel.Memory.mem", "Steel.HigherReference.pts_to_not_null", "FStar.Universe.raise_t", "FStar.Universe.raise_val", "Prims.unit", "Steel.Memory.interp", "Steel.Reference.pts_to_sl", "Prims.squash", "Prims.l_not", "Prims.eq2", "Steel.Reference.null", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let pts_to_not_null (#a: Type u#0) (x: ref a) (p: perm) (v: a) (m: mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) =
let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m
false
Steel.Reference.fst
Steel.Reference.pts_to_perm
val pts_to_perm (#a: _) (#u: _) (#p: _) (#v: _) (r: ref a) : SteelGhost unit u (pts_to r p v) (fun _ -> pts_to r p v) (fun _ -> True) (fun _ _ _ -> p `lesser_equal_perm` full_perm)
val pts_to_perm (#a: _) (#u: _) (#p: _) (#v: _) (r: ref a) : SteelGhost unit u (pts_to r p v) (fun _ -> pts_to r p v) (fun _ -> True) (fun _ _ _ -> p `lesser_equal_perm` full_perm)
let pts_to_perm r = H.pts_to_perm r
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 17, "end_line": 97, "start_col": 0, "start_line": 95 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ())
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> Steel.Effect.Atomic.SteelGhost Prims.unit
Steel.Effect.Atomic.SteelGhost
[]
[]
[ "Steel.Memory.inames", "Steel.FractionalPermission.perm", "Steel.Reference.ref", "Steel.HigherReference.pts_to_perm", "FStar.Universe.raise_t", "FStar.Universe.raise_val", "Prims.unit" ]
[]
false
true
false
false
false
let pts_to_perm r =
H.pts_to_perm r
false
Steel.Reference.fst
Steel.Reference.downgrade_equiv
val downgrade_equiv (#t: Type) (x y: U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y)
val downgrade_equiv (#t: Type) (x y: U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y)
let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 49, "end_line": 180, "start_col": 0, "start_line": 176 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: FStar.Universe.raise_t t -> y: FStar.Universe.raise_t t -> FStar.Pervasives.Lemma (ensures FStar.Universe.downgrade_val x == FStar.Universe.downgrade_val y <==> x == y)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "FStar.Universe.raise_t", "Prims._assert", "Prims.eq2", "FStar.Universe.raise_val", "FStar.Universe.downgrade_val", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.l_iff", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let downgrade_equiv (#t: Type) (x y: U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) =
assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y)
false
Steel.Reference.fst
Steel.Reference.lift_eq
val lift_eq (#t: eqtype) (x y: U.raise_t t) : b: bool{b <==> x == y}
val lift_eq (#t: eqtype) (x y: U.raise_t t) : b: bool{b <==> x == y}
let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 62, "end_line": 184, "start_col": 0, "start_line": 182 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: FStar.Universe.raise_t t -> y: FStar.Universe.raise_t t -> b: Prims.bool{b <==> x == y}
Prims.Tot
[ "total" ]
[]
[ "Prims.eqtype", "FStar.Universe.raise_t", "Prims.op_Equality", "FStar.Universe.downgrade_val", "Prims.unit", "Steel.Reference.downgrade_equiv", "Prims.bool", "Prims.l_iff", "Prims.b2t", "Prims.eq2" ]
[]
false
false
false
false
false
let lift_eq (#t: eqtype) (x y: U.raise_t t) : b: bool{b <==> x == y} =
downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y
false
Steel.Reference.fst
Steel.Reference.ptrp
val ptrp (#a:Type0) (r:ref a) ([@@@smt_fallback] p: perm) : slprop u#1
val ptrp (#a:Type0) (r:ref a) ([@@@smt_fallback] p: perm) : slprop u#1
let ptrp r p = Mem.h_exists (pts_to_sl r p)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 43, "end_line": 253, "start_col": 0, "start_line": 253 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> Steel.Memory.slprop
Prims.Tot
[ "total" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "Steel.Memory.h_exists", "Steel.Reference.pts_to_sl", "Steel.Memory.slprop" ]
[]
false
false
false
true
false
let ptrp r p =
Mem.h_exists (pts_to_sl r p)
false
Steel.Reference.fst
Steel.Reference.cas_action
val cas_action (#t: eqtype) (#uses: inames) (r: ref t) (v: Ghost.erased t) (v_old v_new: t) (frame: slprop) : MstTot (b: bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True)
val cas_action (#t: eqtype) (#uses: inames) (r: ref t) (v: Ghost.erased t) (v_old v_new: t) (frame: slprop) : MstTot (b: bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True)
let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 6, "end_line": 214, "start_col": 0, "start_line": 187 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref t -> v: FStar.Ghost.erased t -> v_old: t -> v_new: t -> frame: Steel.Memory.slprop -> Steel.Memory.MstTot (b: Prims.bool{b <==> FStar.Ghost.reveal v == v_old})
Steel.Memory.MstTot
[]
[]
[ "Prims.eqtype", "Steel.Memory.inames", "Steel.Reference.ref", "FStar.Ghost.erased", "Steel.Memory.slprop", "Prims.unit", "Steel.Reference.raise_equiv", "FStar.Ghost.reveal", "Prims._assert", "Prims.l_iff", "Prims.b2t", "Prims.eq2", "FStar.Universe.raise_t", "FStar.Universe.raise_val", "Prims.bool", "Steel.HigherReference.cas_action", "Steel.Reference.lift_eq", "FStar.Ghost.hide", "Steel.Reference.pts_to_sl", "Steel.FractionalPermission.full_perm", "Steel.Memory.mem", "Prims.l_True", "Prims.prop" ]
[]
false
true
false
false
false
let cas_action (#t: eqtype) (#uses: inames) (r: ref t) (v: Ghost.erased t) (v_old v_new: t) (frame: slprop) : MstTot (b: bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) =
let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b
false
Steel.Reference.fst
Steel.Reference.ghost_ref
val ghost_ref (a:Type u#0) : Type u#0
val ghost_ref (a:Type u#0) : Type u#0
let ghost_ref a = H.ghost_ref (U.raise_t a)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 43, "end_line": 371, "start_col": 0, "start_line": 371 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: Type0 -> Type0
Prims.Tot
[ "total" ]
[]
[ "Steel.HigherReference.ghost_ref", "FStar.Universe.raise_t" ]
[]
false
false
false
true
true
let ghost_ref a =
H.ghost_ref (U.raise_t a)
false
Steel.Reference.fst
Steel.Reference.ghost_pts_to_sl
val ghost_pts_to_sl (#a:_) (r:ghost_ref a) (p:perm) (v:a) : slprop u#1
val ghost_pts_to_sl (#a:_) (r:ghost_ref a) (p:perm) (v:a) : slprop u#1
let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 83, "end_line": 378, "start_col": 0, "start_line": 378 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a)))
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> p: Steel.FractionalPermission.perm -> v: a -> Steel.Memory.slprop
Prims.Tot
[ "total" ]
[]
[ "Steel.Reference.ghost_ref", "Steel.FractionalPermission.perm", "Steel.HigherReference.ghost_pts_to_sl", "FStar.Universe.raise_t", "FStar.Universe.raise_val", "Steel.Memory.slprop" ]
[]
false
false
false
true
false
let ghost_pts_to_sl #a r p x =
H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x)
false
Steel.Reference.fst
Steel.Reference.ptr_sel'
val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p)
val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p)
let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 66, "end_line": 256, "start_col": 0, "start_line": 256 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> Steel.Effect.Common.selector' a (Steel.Reference.ptrp r p)
Prims.Tot
[ "total" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "Steel.Memory.hmem", "Steel.Reference.ptrp", "FStar.Ghost.reveal", "Steel.Memory.id_elim_exists", "Steel.Reference.pts_to_sl" ]
[]
false
false
false
false
false
let ptr_sel' #a r p =
fun h -> id_elim_exists #a (pts_to_sl r p) h
false
Steel.Reference.fst
Steel.Reference.ptrp_sel
val ptrp_sel (#a:Type0) (r:ref a) (p: perm) : selector a (ptrp r p)
val ptrp_sel (#a:Type0) (r:ref a) (p: perm) : selector a (ptrp r p)
let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 14, "end_line": 278, "start_col": 0, "start_line": 275 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> Steel.Effect.Common.selector a (Steel.Reference.ptrp r p)
Prims.Tot
[ "total" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "Steel.Reference.ptr_sel'", "Prims.unit", "FStar.Classical.forall_intro", "Steel.Memory.hmem", "Steel.Reference.ptrp", "Prims.eq2", "Steel.Memory.core_mem", "Steel.Reference.ptr_sel_depends_only_on_core", "FStar.Classical.forall_intro_2", "Steel.Memory.mem", "Steel.Memory.disjoint", "Steel.Memory.join", "Steel.Reference.ptr_sel_depends_only_on", "Steel.Effect.Common.selector" ]
[]
false
false
false
false
false
let ptrp_sel r p =
Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p
false
Steel.ST.GenElim1.fst
Steel.ST.GenElim1.compute_gen_elim_nondep_correct8
val compute_gen_elim_nondep_correct8 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7 t8: Type) : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8])
val compute_gen_elim_nondep_correct8 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7 t8: Type) : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8])
let compute_gen_elim_nondep_correct8 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7 t8: Type) : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8]) = fun q post intro _ -> intro _; rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> q x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ()))))))))))); let x1 = elim_exists' () in let x2 = elim_exists' () in let x3 = elim_exists' () in let x4 = elim_exists' () in let x5 = elim_exists' () in let x6 = elim_exists' () in let x7 = elim_exists' () in let x8 = elim_exists' () in let res = Mktuple8 x1 x2 x3 x4 x5 x6 x7 x8 in elim_pure _; rewrite_with_trefl (q _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ())); res
{ "file_name": "lib/steel/Steel.ST.GenElim1.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 7, "end_line": 616, "start_col": 0, "start_line": 598 }
module Steel.ST.GenElim1 let gen_elim_f (p: vprop) (a: Type) (q: (a -> vprop)) (post: (a -> prop)) : Tot Type = ((opened: inames) -> STGhost a opened p q True post) module U = FStar.Universe let gen_unit_elim_t (i: gen_unit_elim_i) : Tot Type = gen_elim_f (compute_gen_unit_elim_p i) (U.raise_t u#_ u#1 unit) (fun _ -> compute_gen_unit_elim_q i) (fun _ -> compute_gen_unit_elim_post i) let compute_gen_unit_elim_f_id (v: vprop) : Tot (gen_unit_elim_t (GUEId v)) = fun _ -> noop (); U.raise_val () let compute_gen_unit_elim_f_pure (p: prop) : Tot (gen_unit_elim_t (GUEPure p)) = fun _ -> rewrite (compute_gen_unit_elim_p (GUEPure p)) (pure p); elim_pure p; U.raise_val () let compute_gen_unit_elim_f_star (i1 i2: gen_unit_elim_i) (f1: gen_unit_elim_t i1) (f2: gen_unit_elim_t i2) : Tot (gen_unit_elim_t (GUEStar i1 i2)) = fun _ -> rewrite (compute_gen_unit_elim_p (GUEStar i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_unit_elim_p i2); let _ = f1 _ in let _ = f2 _ in rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_unit_elim_q i2) (compute_gen_unit_elim_q (GUEStar i1 i2)); U.raise_val () let rec compute_gen_unit_elim_f (i: gen_unit_elim_i) : GTot (gen_unit_elim_t i) = match i returns (gen_unit_elim_t i) with | GUEId v -> compute_gen_unit_elim_f_id v | GUEPure p -> compute_gen_unit_elim_f_pure p | GUEStar i1 i2 -> compute_gen_unit_elim_f_star i1 i2 (compute_gen_unit_elim_f i1) (compute_gen_unit_elim_f i2) let gen_elim_t (i: gen_elim_i) : Tot Type = gen_elim_f (compute_gen_elim_p i) (compute_gen_elim_a i) (compute_gen_elim_q i) (compute_gen_elim_post i) let compute_gen_elim_f_unit (i: gen_unit_elim_i) : GTot (gen_elim_t (GEUnit i)) = compute_gen_unit_elim_f i let compute_gen_elim_f_star_l (i1: gen_elim_i) (f1: gen_elim_t i1) (i2: gen_unit_elim_i) : GTot (gen_elim_t (GEStarL i1 i2)) = let f2 = compute_gen_unit_elim_f i2 in fun _ -> rewrite (compute_gen_elim_p (GEStarL i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_unit_elim_p i2); let res = f1 _ in let _ = f2 _ in let res' : compute_gen_elim_a (GEStarL i1 i2) = coerce_with_trefl res in rewrite (compute_gen_elim_q i1 res `star` compute_gen_unit_elim_q i2) (compute_gen_elim_q (GEStarL i1 i2) res'); res' let compute_gen_elim_f_star_r (i1: gen_unit_elim_i) (i2: gen_elim_i) (f2: gen_elim_t i2) : GTot (gen_elim_t (GEStarR i1 i2)) = let f1 = compute_gen_unit_elim_f i1 in fun _ -> rewrite (compute_gen_elim_p (GEStarR i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_elim_p i2); let _ = f1 _ in let res = f2 _ in let res' : compute_gen_elim_a (GEStarR i1 i2) = coerce_with_trefl res in rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_elim_q i2 res) (compute_gen_elim_q (GEStarR i1 i2) res'); res' let compute_gen_elim_f_star (i1: gen_elim_i) (f1: gen_elim_t i1) (i2: gen_elim_i) (f2: gen_elim_t i2) : GTot (gen_elim_t (GEStar i1 i2)) = fun _ -> rewrite (compute_gen_elim_p (GEStar i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_elim_p i2); let res1 = f1 _ in let res2 = f2 _ in let res : compute_gen_elim_a (GEStar i1 i2) = coerce_with_trefl (res1, res2) in rewrite (compute_gen_elim_q i1 res1 `star` compute_gen_elim_q i2 res2) (compute_gen_elim_q (GEStar i1 i2) res); res let compute_gen_elim_f_exists_no_abs0 (a: Type0) (body: (a -> vprop)) : GTot (gen_elim_t (GEExistsNoAbs0 body)) = fun _ -> rewrite (compute_gen_elim_p (GEExistsNoAbs0 body)) (exists_ body); let gres = elim_exists () in let res : compute_gen_elim_a (GEExistsNoAbs0 body) = U.raise_val (Ghost.reveal gres) in // coerce_with_trefl (Ghost.reveal gres) in rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs0 body) res); res let rewrite_with_trefl (#opened:_) (p q:vprop) : STGhost unit opened p (fun _ -> q) (requires T.with_tactic T.trefl (p == q)) (ensures fun _ -> True) = rewrite p q let compute_gen_elim_f_exists_unit0 (a: Type0) (body: a -> gen_unit_elim_i) : Tot (gen_elim_t (GEExistsUnit0 body)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p (GEExistsUnit0 body)) (exists_ (fun x -> compute_gen_unit_elim_p (body x))); let gres = elim_exists () in let _ = compute_gen_unit_elim_f (body gres) _ in let res : compute_gen_elim_a (GEExistsUnit0 body) = U.raise_val (Ghost.reveal gres) in // coerce_with_trefl (Ghost.reveal gres) in rewrite (compute_gen_unit_elim_q (body gres)) (compute_gen_elim_q (GEExistsUnit0 body) res); res let compute_gen_elim_f_exists0 (a: Type0) (body: a -> gen_elim_i) (f: (x: a) -> GTot (gen_elim_t (body x))) : Tot (gen_elim_t (GEExists0 body)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p (GEExists0 body)) (exists_ (fun x -> compute_gen_elim_p (body x))); let gres1 = elim_exists () in let gres2 = f gres1 _ in let res : compute_gen_elim_a (GEExists0 body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists0 body) res); res let compute_gen_elim_f_exists_no_abs1 (a: Type) (body: (a -> vprop)) : GTot (gen_elim_t (GEExistsNoAbs1 body)) = fun _ -> rewrite (compute_gen_elim_p (GEExistsNoAbs1 body)) (exists_ body); let gres = elim_exists () in let res : compute_gen_elim_a (GEExistsNoAbs1 body) = coerce_with_trefl (Ghost.reveal gres) in rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs1 body) res); res let compute_gen_elim_f_exists_unit1 (a: Type) (body: a -> gen_unit_elim_i) : Tot (gen_elim_t (GEExistsUnit1 body)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p (GEExistsUnit1 body)) (exists_ (fun x -> compute_gen_unit_elim_p (body x))); let gres = elim_exists () in let _ = compute_gen_unit_elim_f (body gres) _ in let res : compute_gen_elim_a (GEExistsUnit1 body) = coerce_with_trefl (Ghost.reveal gres) in rewrite (compute_gen_unit_elim_q (body gres)) (compute_gen_elim_q (GEExistsUnit1 body) res); res let compute_gen_elim_f_exists1 (a: Type) (body: a -> gen_elim_i) (f: (x: a) -> GTot (gen_elim_t (body x))) : Tot (gen_elim_t (GEExists1 body)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p (GEExists1 body)) (exists_ (fun x -> compute_gen_elim_p (body x))); let gres1 = elim_exists () in let gres2 = f gres1 _ in let res : compute_gen_elim_a (GEExists1 body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists1 body) res); res let rec compute_gen_elim_f (i: gen_elim_i) : GTot (gen_elim_t i) = match i returns (gen_elim_t i) with | GEUnit i -> compute_gen_elim_f_unit i | GEStarL i1 i2 -> compute_gen_elim_f_star_l i1 (compute_gen_elim_f i1) i2 | GEStarR i1 i2 -> compute_gen_elim_f_star_r i1 i2 (compute_gen_elim_f i2) | GEStar i1 i2 -> compute_gen_elim_f_star i1 (compute_gen_elim_f i1) i2 (compute_gen_elim_f i2) | GEExistsNoAbs0 body -> compute_gen_elim_f_exists_no_abs0 _ body | GEExistsUnit0 body -> compute_gen_elim_f_exists_unit0 _ body | GEExists0 body -> compute_gen_elim_f_exists0 _ body (fun x -> compute_gen_elim_f (body x)) | GEExistsNoAbs1 body -> compute_gen_elim_f_exists_no_abs1 _ body | GEExistsUnit1 body -> compute_gen_elim_f_exists_unit1 _ body | GEExists1 body -> compute_gen_elim_f_exists1 _ body (fun x -> compute_gen_elim_f (body x)) let rec tele_p (x: gen_elim_tele) : Tot vprop = match x with | TRet v p -> v `star` pure p | TExists ty body -> exists_ (fun x -> tele_p (body x)) let elim_exists' (#a:Type) (#opened_invariants:_) (#p:a -> vprop) (_:unit) : STGhostT (a) opened_invariants (exists_ p) (fun x -> p x) = let gx = elim_exists () in let x = Ghost.reveal gx in rewrite (p gx) (p x); x let vprop_rewrite (from to: vprop) : Tot Type = gen_elim_f from unit (fun _ -> to) (fun _ -> True) let tele_star_vprop_correct_ret (v': vprop) (p': prop) (v: vprop) (p: prop) : Tot (vprop_rewrite (tele_p (TRet v' p') `star` v `star` pure p) (tele_p (tele_star_vprop (TRet v' p') v p))) = fun _ -> elim_pure p; rewrite (tele_p _) (v' `star` pure p'); elim_pure p'; intro_pure (p /\ p'); rewrite ((v `star` v') `star` pure (p /\ p')) (tele_p _) let tele_star_vprop_correct_exists (v: vprop) (p: prop) (ty: _) (body: ty -> gen_elim_tele) (ih: (x: ty) -> GTot (vprop_rewrite (tele_p (body x) `star` v `star` pure p) (tele_p (tele_star_vprop (body x) v p)))) : Tot (vprop_rewrite (tele_p (TExists ty body) `star` v `star` pure p) (tele_p (tele_star_vprop (TExists ty body) v p))) = fun _ -> rewrite_with_trefl (tele_p _) (exists_ (fun x -> tele_p (body x))); let x = elim_exists' () in ih x _; intro_exists x (fun x -> tele_p (tele_star_vprop (body x) v p)); rewrite_with_trefl (exists_ (fun x -> tele_p (tele_star_vprop (body x) v p))) (tele_p _) let rec tele_star_vprop_correct (i: gen_elim_tele) (v: vprop) (p: prop) : GTot (vprop_rewrite (tele_p i `star` v `star` pure p) (tele_p (tele_star_vprop i v p)) ) = match i returns vprop_rewrite (tele_p i `star` v `star` pure p) (tele_p (tele_star_vprop i v p)) with | TRet v' p' -> tele_star_vprop_correct_ret v' p' v p | TExists ty body -> tele_star_vprop_correct_exists v p ty body (fun x -> tele_star_vprop_correct (body x) v p) let tele_star_correct_ret_l (v1: vprop) (p1: prop) (i2: gen_elim_tele) : Tot (vprop_rewrite (tele_p (TRet v1 p1) `star` tele_p i2) (tele_p (TRet v1 p1 `tele_star` i2))) = fun _ -> rewrite (tele_p (TRet v1 p1)) (v1 `star` pure p1); tele_star_vprop_correct i2 v1 p1 _; rewrite (tele_p _) (tele_p _) let tele_star_correct_ret_r (i1: gen_elim_tele { ~ (TRet? i1) }) (v2: vprop) (p2: prop) : Tot (vprop_rewrite (tele_p i1 `star` tele_p (TRet v2 p2)) (tele_p (i1 `tele_star` TRet v2 p2))) = fun _ -> rewrite (tele_p (TRet v2 p2)) (v2 `star` pure p2); tele_star_vprop_correct i1 v2 p2 _; rewrite (tele_p _) (tele_p (i1 `tele_star` TRet v2 p2)) let tele_star_correct_exists (ty1: _) (f1: ty1 -> gen_elim_tele) (ty2: _) (f2: ty2 -> gen_elim_tele) (ih: (x1: ty1) -> (x2: ty2) -> GTot (vprop_rewrite (tele_p (f1 x1) `star` tele_p (f2 x2)) (tele_p (f1 x1 `tele_star` f2 x2)))) : Tot (vprop_rewrite (tele_p (TExists ty1 f1) `star` tele_p (TExists ty2 f2)) (tele_p (tele_star (TExists ty1 f1) (TExists ty2 f2)))) = fun _ -> rewrite_with_trefl (tele_p (TExists ty1 f1)) (exists_ (fun x1 -> tele_p (f1 x1))); let x1 = elim_exists' () in rewrite_with_trefl (tele_p (TExists ty2 f2)) (exists_ (fun x2 -> tele_p (f2 x2))); let x2 = elim_exists' () in ih x1 x2 _; intro_exists x2 (fun x2 -> tele_p (tele_star (f1 x1) (f2 x2))); intro_exists x1 (fun x1 -> exists_ (fun x2 -> tele_p (tele_star (f1 x1) (f2 x2)))); rewrite_with_trefl (exists_ _) (tele_p _) let rec tele_star_correct (i1 i2: gen_elim_tele) : GTot (vprop_rewrite (tele_p i1 `star` tele_p i2) (tele_p (i1 `tele_star` i2))) = match i1 returns vprop_rewrite (tele_p i1 `star` tele_p i2) (tele_p (i1 `tele_star` i2)) with | TRet v1 p1 -> tele_star_correct_ret_l v1 p1 i2 | TExists ty1 f1 -> begin match i2 returns vprop_rewrite (tele_p (TExists ty1 f1) `star` tele_p i2) (tele_p (TExists ty1 f1 `tele_star` i2)) with | TRet v2 p2 -> tele_star_correct_ret_r (TExists ty1 f1) v2 p2 | TExists ty2 f2 -> tele_star_correct_exists ty1 f1 ty2 f2 (fun x1 x2 -> tele_star_correct (f1 x1) (f2 x2)) end [@@noextract_to "Plugin" ] let ge_to_tele_t (i: gen_elim_i) : Tot Type = vprop_rewrite (compute_gen_elim_p i) (tele_p (compute_gen_elim_tele i)) let compute_gen_elim_tele_correct_unit (v: gen_unit_elim_i) : Tot (ge_to_tele_t (GEUnit v)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_unit_elim_p v); let _ = compute_gen_unit_elim_f v _ in intro_pure (compute_gen_unit_elim_post v); rewrite_with_trefl (compute_gen_unit_elim_q v `star` pure _) (tele_p _) let compute_gen_elim_tele_correct_star_l (l: gen_elim_i) (ihl: ge_to_tele_t l) (ru: gen_unit_elim_i) : Tot (ge_to_tele_t (GEStarL l ru)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_elim_p l `star` compute_gen_unit_elim_p ru); ihl _; let _ = compute_gen_unit_elim_f ru _ in intro_pure (compute_gen_unit_elim_post ru); tele_star_vprop_correct _ _ _ _; rewrite_with_trefl (tele_p _) (tele_p _) let compute_gen_elim_tele_correct_star_r (lu: gen_unit_elim_i) (r: gen_elim_i) (ihr: ge_to_tele_t r) : Tot (ge_to_tele_t (GEStarR lu r)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_unit_elim_p lu `star` compute_gen_elim_p r); ihr _; let _ = compute_gen_unit_elim_f lu _ in intro_pure (compute_gen_unit_elim_post lu); tele_star_vprop_correct _ _ _ _; rewrite_with_trefl (tele_p _) (tele_p _) let compute_gen_elim_tele_correct_star (l: gen_elim_i) (ihl: ge_to_tele_t l) (r: gen_elim_i) (ihr: ge_to_tele_t r) : Tot (ge_to_tele_t (GEStar l r)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_elim_p l `star` compute_gen_elim_p r); ihl _; ihr _; tele_star_correct (compute_gen_elim_tele l) (compute_gen_elim_tele r) _; rewrite_with_trefl (tele_p _) (tele_p _) let compute_gen_elim_tele_correct_exists_no_abs0 (ty: _) (body: ty -> vprop) : Tot (ge_to_tele_t (GEExistsNoAbs0 #ty body)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p _) (exists_ body); let x = elim_exists' () in intro_pure True; rewrite (body x) (body (U.downgrade_val (U.raise_val x))); intro_exists (U.raise_val u#0 u#1 x) (fun x -> body (U.downgrade_val x) `star` pure True); rewrite_with_trefl (exists_ _) (tele_p _) let compute_gen_elim_tele_correct_exists_unit0 (ty: _) (body: ty -> gen_unit_elim_i) : Tot (ge_to_tele_t (GEExistsUnit0 #ty body)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_unit_elim_p (body x))); let x = elim_exists' () in let _ = compute_gen_unit_elim_f (body x) _ in intro_pure (compute_gen_unit_elim_post (body (U.downgrade_val (U.raise_val u#0 u#1 x)))); rewrite (compute_gen_unit_elim_q (body x)) (compute_gen_unit_elim_q (body (U.downgrade_val (U.raise_val x)))); intro_exists (U.raise_val u#0 u#1 x) (fun x -> compute_gen_unit_elim_q (body (U.downgrade_val x)) `star` pure (compute_gen_unit_elim_post (body (U.downgrade_val x)))); rewrite_with_trefl (exists_ _) (tele_p _) let compute_gen_elim_tele_correct_exists0 (ty: _) (body: ty -> gen_elim_i) (ih: (x: ty) -> GTot (ge_to_tele_t (body x))) : Tot (ge_to_tele_t (GEExists0 #ty body)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x))); let x = elim_exists' () in ih x _; rewrite (tele_p (compute_gen_elim_tele (body x))) (tele_p (compute_gen_elim_tele (body (U.downgrade_val (U.raise_val u#0 u#1 x))))); intro_exists (U.raise_val u#0 u#1 x) (fun x -> tele_p (compute_gen_elim_tele (body (U.downgrade_val u#0 u#1 x)))); rewrite_with_trefl (exists_ _) (tele_p _) let compute_gen_elim_tele_correct_exists_no_abs1 (ty: _) (body: ty -> vprop) : Tot (ge_to_tele_t (GEExistsNoAbs1 #ty body)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p _) (exists_ body); let x = elim_exists' () in intro_pure True; intro_exists x (fun x -> body x `star` pure True); rewrite_with_trefl (exists_ _) (tele_p _) let compute_gen_elim_tele_correct_exists_unit1 (ty: _) (body: ty -> gen_unit_elim_i) : Tot (ge_to_tele_t (GEExistsUnit1 #ty body)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_unit_elim_p (body x))); let x = elim_exists' () in let _ = compute_gen_unit_elim_f (body x) _ in intro_pure (compute_gen_unit_elim_post (body x)); intro_exists x (fun x -> compute_gen_unit_elim_q (body x) `star` pure (compute_gen_unit_elim_post (body x))); rewrite_with_trefl (exists_ _) (tele_p _) let compute_gen_elim_tele_correct_exists1 (ty: _) (body: ty -> gen_elim_i) (ih: (x: ty) -> GTot (ge_to_tele_t (body x))) : Tot (ge_to_tele_t (GEExists1 #ty body)) = fun _ -> rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x))); let x = elim_exists' () in ih x _; intro_exists x (fun x -> tele_p (compute_gen_elim_tele (body x))); rewrite_with_trefl (exists_ _) (tele_p _) let rec compute_gen_elim_tele_correct (x: gen_elim_i) : GTot (ge_to_tele_t x) = match x returns ge_to_tele_t x with | GEUnit v -> compute_gen_elim_tele_correct_unit v | GEStarL l ru -> compute_gen_elim_tele_correct_star_l l (compute_gen_elim_tele_correct l) ru | GEStarR lu r -> compute_gen_elim_tele_correct_star_r lu r (compute_gen_elim_tele_correct r) | GEStar l r -> compute_gen_elim_tele_correct_star l (compute_gen_elim_tele_correct l) r (compute_gen_elim_tele_correct r) | GEExistsNoAbs0 #ty body -> compute_gen_elim_tele_correct_exists_no_abs0 ty body | GEExistsUnit0 #ty body -> compute_gen_elim_tele_correct_exists_unit0 ty body | GEExists0 #ty body -> compute_gen_elim_tele_correct_exists0 ty body (fun x -> compute_gen_elim_tele_correct (body x)) | GEExistsNoAbs1 #ty body -> compute_gen_elim_tele_correct_exists_no_abs1 ty body | GEExistsUnit1 #ty body -> compute_gen_elim_tele_correct_exists_unit1 ty body | GEExists1 #ty body -> compute_gen_elim_tele_correct_exists1 ty body (fun x -> compute_gen_elim_tele_correct (body x)) let rec gen_elim_nondep_p (ty: list (Type u#a)) : Tot (curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop) = match ty as ty' returns curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop with | [] -> fun q post -> q (U.raise_val ()) `star` pure (post (U.raise_val ())) | t :: tq -> fun q post -> exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)) let rec gen_elim_nondep_sem_correct (ty: list (Type u#a)) : Tot ((q: curried_function_type ty _) -> (post: curried_function_type ty _) -> Lemma (tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post) ) = match ty returns ((q: curried_function_type ty _) -> (post: curried_function_type ty _) -> Lemma (tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post) ) with | [] -> fun q post -> equiv_refl (q (U.raise_val ()) `star` pure (post (U.raise_val ()))) | ta :: tq -> fun q post -> let phi (x: ta) : Lemma (tele_p (gen_elim_nondep_sem tq (q x) (post x)) `equiv` gen_elim_nondep_p tq (q x) (post x)) = gen_elim_nondep_sem_correct tq (q x) (post x) in Classical.forall_intro phi; let prf () : Lemma (exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) `equiv` exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x))) = exists_equiv (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) (fun x -> gen_elim_nondep_p tq (q x) (post x)) in assert_norm (tele_p (gen_elim_nondep_sem (ta :: tq) q post) == exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x)))); assert_norm (gen_elim_nondep_p (ta :: tq) q post == exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x))); prf () let compute_gen_elim_nondep_correct_t (i0: gen_elim_i) (ty: list (Type u#1)) : Tot Type = (q: _) -> (post: _) -> (intro: vprop_rewrite (compute_gen_elim_p i0) (gen_elim_nondep_p ty q post)) -> GTot (gen_elim_f (compute_gen_elim_p i0) (compute_gen_elim_nondep_a' ty) (fun x -> compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) ty q x (U.raise_val ())) (fun x -> compute_uncurry _ (fun _ -> True) ty post x (U.raise_val ())) ) let compute_gen_elim_nondep_correct0 (i0: gen_elim_i) : Tot (compute_gen_elim_nondep_correct_t i0 []) = fun q post intro _ -> intro _; rewrite_with_trefl (gen_elim_nondep_p _ _ _) (q (U.raise_val ()) `star` pure (post (U.raise_val ()))); let res = U.raise_val () in elim_pure _; rewrite_with_trefl (q (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ())); res let compute_gen_elim_nondep_correct1 (i0: gen_elim_i) (t1: Type) : Tot (compute_gen_elim_nondep_correct_t i0 [t1]) = fun q post intro _ -> intro _; rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> q x1 (U.raise_val ()) `star` pure (post x1 (U.raise_val ())))); let res = elim_exists' () in elim_pure _; rewrite_with_trefl (q _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ())); res let compute_gen_elim_nondep_correct2 (i0: gen_elim_i) (t1 t2: Type) : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2]) = fun q post intro _ -> intro _; rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> q x1 x2 (U.raise_val ()) `star` pure (post x1 x2 (U.raise_val ()))))); let x1 = elim_exists' () in let x2 = elim_exists' () in let res = Mktuple2 x1 x2 in elim_pure _; rewrite_with_trefl (q _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ())); res let compute_gen_elim_nondep_correct3 (i0: gen_elim_i) (t1 t2 t3: Type) : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3]) = fun q post intro _ -> intro _; rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> q x1 x2 x3 (U.raise_val ()) `star` pure (post x1 x2 x3 (U.raise_val ())))))); let x1 = elim_exists' () in let x2 = elim_exists' () in let x3 = elim_exists' () in let res = Mktuple3 x1 x2 x3 in elim_pure _; rewrite_with_trefl (q _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ())); res let compute_gen_elim_nondep_correct4 (i0: gen_elim_i) (t1 t2 t3 t4: Type) : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4]) = fun q post intro _ -> intro _; rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> q x1 x2 x3 x4 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 (U.raise_val ()))))))); let x1 = elim_exists' () in let x2 = elim_exists' () in let x3 = elim_exists' () in let x4 = elim_exists' () in let res = Mktuple4 x1 x2 x3 x4 in elim_pure _; rewrite_with_trefl (q _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ())); res let compute_gen_elim_nondep_correct5 (i0: gen_elim_i) (t1 t2 t3 t4 t5: Type) : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5]) = fun q post intro _ -> intro _; rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> q x1 x2 x3 x4 x5 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 (U.raise_val ())))))))); let x1 = elim_exists' () in let x2 = elim_exists' () in let x3 = elim_exists' () in let x4 = elim_exists' () in let x5 = elim_exists' () in let res = Mktuple5 x1 x2 x3 x4 x5 in elim_pure _; rewrite_with_trefl (q _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ())); res let compute_gen_elim_nondep_correct6 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6: Type) : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6]) = fun q post intro _ -> intro _; rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> q x1 x2 x3 x4 x5 x6 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 (U.raise_val ()))))))))); let x1 = elim_exists' () in let x2 = elim_exists' () in let x3 = elim_exists' () in let x4 = elim_exists' () in let x5 = elim_exists' () in let x6 = elim_exists' () in let res = Mktuple6 x1 x2 x3 x4 x5 x6 in elim_pure _; rewrite_with_trefl (q _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ())); res let compute_gen_elim_nondep_correct7 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7: Type) : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7]) = fun q post intro _ -> intro _; rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> q x1 x2 x3 x4 x5 x6 x7 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 (U.raise_val ())))))))))); let x1 = elim_exists' () in let x2 = elim_exists' () in let x3 = elim_exists' () in let x4 = elim_exists' () in let x5 = elim_exists' () in let x6 = elim_exists' () in let x7 = elim_exists' () in let res = Mktuple7 x1 x2 x3 x4 x5 x6 x7 in elim_pure _; rewrite_with_trefl (q _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ())); res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.ST.GenElim1.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": false, "full_module": "Steel.ST.GenElim1.Base", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "Steel.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
i0: Steel.ST.GenElim1.Base.gen_elim_i -> t1: Type -> t2: Type -> t3: Type -> t4: Type -> t5: Type -> t6: Type -> t7: Type -> t8: Type -> Steel.ST.GenElim1.compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8]
Prims.Tot
[ "total" ]
[]
[ "Steel.ST.GenElim1.Base.gen_elim_i", "Steel.ST.GenElim1.Base.curried_function_type", "Prims.Cons", "Prims.Nil", "FStar.Universe.raise_t", "Prims.unit", "Steel.Effect.Common.vprop", "Prims.prop", "Steel.ST.GenElim1.vprop_rewrite", "Steel.ST.GenElim1.Base.compute_gen_elim_p", "Steel.ST.GenElim1.gen_elim_nondep_p", "Steel.Memory.inames", "Steel.ST.GenElim1.Base.compute_gen_elim_nondep_a'", "Steel.ST.GenElim1.rewrite_with_trefl", "FStar.Universe.raise_val", "Steel.ST.GenElim1.Base.compute_uncurry", "Steel.ST.GenElim1.Base.compute_gen_elim_p'", "Steel.ST.Util.elim_pure", "FStar.Pervasives.Native.tuple8", "FStar.Pervasives.Native.Mktuple8", "Steel.ST.GenElim1.elim_exists'", "Steel.Effect.Common.VStar", "Steel.ST.Util.pure", "Steel.ST.Util.exists_", "Steel.Effect.Common.star", "Steel.ST.GenElim1.compute_gen_elim_nondep_correct_t" ]
[]
false
false
false
false
false
let compute_gen_elim_nondep_correct8 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7 t8: Type) : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8]) =
fun q post intro _ -> intro _; rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> (q x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ())) `star` (pure (post x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ())))))))))))); let x1 = elim_exists' () in let x2 = elim_exists' () in let x3 = elim_exists' () in let x4 = elim_exists' () in let x5 = elim_exists' () in let x6 = elim_exists' () in let x7 = elim_exists' () in let x8 = elim_exists' () in let res = Mktuple8 x1 x2 x3 x4 x5 x6 x7 x8 in elim_pure _; rewrite_with_trefl (q _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ())); res
false
Steel.Reference.fst
Steel.Reference.raise_erased
val raise_erased (#a: Type0) (x: erased a) : erased (U.raise_t u#0 u#1 a)
val raise_erased (#a: Type0) (x: erased a) : erased (U.raise_t u#0 u#1 a)
let raise_erased (#a:Type0) (x:erased a) : erased (U.raise_t u#0 u#1 a) = Ghost.hide (U.raise_val (Ghost.reveal x))
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 45, "end_line": 392, "start_col": 0, "start_line": 390 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x) let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y))
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: FStar.Ghost.erased a -> FStar.Ghost.erased (FStar.Universe.raise_t a)
Prims.Tot
[ "total" ]
[]
[ "FStar.Ghost.erased", "FStar.Ghost.hide", "FStar.Universe.raise_t", "FStar.Universe.raise_val", "FStar.Ghost.reveal" ]
[]
false
false
false
true
false
let raise_erased (#a: Type0) (x: erased a) : erased (U.raise_t u#0 u#1 a) =
Ghost.hide (U.raise_val (Ghost.reveal x))
false
Steel.Reference.fst
Steel.Reference.intro_ptrp_interp
val intro_ptrp_interp (#a:Type0) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m)
val intro_ptrp_interp (#a:Type0) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m)
let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 75, "end_line": 282, "start_col": 0, "start_line": 282 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> v: FStar.Ghost.erased a -> m: Steel.Memory.mem -> FStar.Pervasives.Lemma (requires Steel.Memory.interp (Steel.Reference.pts_to_sl r p (FStar.Ghost.reveal v)) m) (ensures Steel.Memory.interp (Steel.Reference.ptrp r p) m)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "FStar.Ghost.erased", "Steel.Memory.mem", "Steel.Memory.intro_h_exists", "FStar.Ghost.reveal", "Steel.Reference.pts_to_sl", "Prims.unit" ]
[]
true
false
true
false
false
let intro_ptrp_interp r p v m =
intro_h_exists (reveal v) (pts_to_sl r p) m
false
Steel.Reference.fst
Steel.Reference.intro_vptr_lemma
val intro_vptr_lemma (#a: Type) (r: ref a) (p: perm) (v: erased a) (m: mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v)
val intro_vptr_lemma (#a: Type) (r: ref a) (p: perm) (v: erased a) (m: mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v)
let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 21, "end_line": 288, "start_col": 0, "start_line": 284 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> v: FStar.Ghost.erased a -> m: Steel.Memory.mem -> FStar.Pervasives.Lemma (requires Steel.Memory.interp (Steel.Reference.pts_to_sl r p (FStar.Ghost.reveal v)) m) (ensures Steel.Memory.interp (Steel.Reference.ptrp r p) m /\ Steel.Reference.ptrp_sel r p m == FStar.Ghost.reveal v)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "FStar.Ghost.erased", "Steel.Memory.mem", "Steel.Reference.pts_to_witinv", "Prims.unit", "Steel.Memory.intro_h_exists", "FStar.Ghost.reveal", "Steel.Reference.pts_to_sl", "Steel.Memory.interp", "Prims.squash", "Prims.l_and", "Steel.Reference.ptrp", "Prims.eq2", "Steel.Reference.ptrp_sel", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let intro_vptr_lemma (#a: Type) (r: ref a) (p: perm) (v: erased a) (m: mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) =
Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p
false
Steel.Reference.fst
Steel.Reference.elim_vptr_lemma
val elim_vptr_lemma (#a: Type) (r: ref a) (p: perm) (v: erased a) (m: mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m)
val elim_vptr_lemma (#a: Type) (r: ref a) (p: perm) (v: erased a) (m: mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m)
let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 21, "end_line": 294, "start_col": 0, "start_line": 290 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> v: FStar.Ghost.erased a -> m: Steel.Memory.mem -> FStar.Pervasives.Lemma (requires Steel.Memory.interp (Steel.Reference.ptrp r p) m /\ Steel.Reference.ptrp_sel r p m == FStar.Ghost.reveal v) (ensures Steel.Memory.interp (Steel.Reference.pts_to_sl r p (FStar.Ghost.reveal v)) m)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "FStar.Ghost.erased", "Steel.Memory.mem", "Steel.Reference.pts_to_witinv", "Prims.unit", "Steel.Memory.elim_h_exists", "Steel.Reference.pts_to_sl", "Prims.l_and", "Steel.Memory.interp", "Steel.Reference.ptrp", "Prims.eq2", "Steel.Reference.ptrp_sel", "FStar.Ghost.reveal", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let elim_vptr_lemma (#a: Type) (r: ref a) (p: perm) (v: erased a) (m: mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) =
Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p
false
Steel.Reference.fst
Steel.Reference.ptr_sel_depends_only_on_core
val ptr_sel_depends_only_on_core (#a: Type0) (r: ref a) (p: perm) (m0: Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0))
val ptr_sel_depends_only_on_core (#a: Type0) (r: ref a) (p: perm) (m0: Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0))
let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 45, "end_line": 273, "start_col": 0, "start_line": 267 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> m0: Steel.Memory.hmem (Steel.Reference.ptrp r p) -> FStar.Pervasives.Lemma (ensures Steel.Reference.ptr_sel' r p m0 == Steel.Reference.ptr_sel' r p (Steel.Memory.core_mem m0))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "Steel.Memory.hmem", "Steel.Reference.ptrp", "Steel.Memory.elim_wi", "Steel.Reference.pts_to_sl", "Steel.Memory.core_mem", "Prims.unit", "Steel.Reference.pts_to_witinv", "FStar.Ghost.reveal", "Steel.Memory.id_elim_exists", "Prims.l_True", "Prims.squash", "Prims.eq2", "Steel.Reference.ptr_sel'", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let ptr_sel_depends_only_on_core (#a: Type0) (r: ref a) (p: perm) (m0: Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) =
let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0)
false
Steel.Reference.fst
Steel.Reference.ptr_sel_depends_only_on
val ptr_sel_depends_only_on (#a: Type0) (r: ref a) (p: perm) (m0: Mem.hmem (ptrp r p)) (m1: mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1))
val ptr_sel_depends_only_on (#a: Type0) (r: ref a) (p: perm) (m0: Mem.hmem (ptrp r p)) (m1: mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1))
let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 48, "end_line": 265, "start_col": 0, "start_line": 258 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> m0: Steel.Memory.hmem (Steel.Reference.ptrp r p) -> m1: Steel.Memory.mem{Steel.Memory.disjoint m0 m1} -> FStar.Pervasives.Lemma (ensures Steel.Reference.ptr_sel' r p m0 == Steel.Reference.ptr_sel' r p (Steel.Memory.join m0 m1))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "Steel.Memory.hmem", "Steel.Reference.ptrp", "Steel.Memory.mem", "Steel.Memory.disjoint", "Steel.Memory.elim_wi", "Steel.Reference.pts_to_sl", "Steel.Memory.join", "Prims.unit", "Steel.Reference.pts_to_witinv", "FStar.Ghost.reveal", "Steel.Memory.id_elim_exists", "Prims.l_True", "Prims.squash", "Prims.eq2", "Steel.Reference.ptr_sel'", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let ptr_sel_depends_only_on (#a: Type0) (r: ref a) (p: perm) (m0: Mem.hmem (ptrp r p)) (m1: mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) =
let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1)
false
Steel.Reference.fst
Steel.Reference.ptrp_sel_interp
val ptrp_sel_interp (#a:Type0) (r:ref a) (p: perm) (m:mem) : Lemma (requires interp (ptrp r p) m) (ensures interp (pts_to_sl r p (ptrp_sel r p m)) m)
val ptrp_sel_interp (#a:Type0) (r:ref a) (p: perm) (m:mem) : Lemma (requires interp (ptrp r p) m) (ensures interp (pts_to_sl r p (ptrp_sel r p m)) m)
let ptrp_sel_interp #a r p m = pts_to_witinv r p
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 48, "end_line": 280, "start_col": 0, "start_line": 280 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> m: Steel.Memory.mem -> FStar.Pervasives.Lemma (requires Steel.Memory.interp (Steel.Reference.ptrp r p) m) (ensures Steel.Memory.interp (Steel.Reference.pts_to_sl r p (Steel.Reference.ptrp_sel r p m)) m)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ref", "Steel.FractionalPermission.perm", "Steel.Memory.mem", "Steel.Reference.pts_to_witinv", "Prims.unit" ]
[]
true
false
true
false
false
let ptrp_sel_interp #a r p m =
pts_to_witinv r p
false
Steel.Reference.fst
Steel.Reference.dummy_ghost_ref
val dummy_ghost_ref (a: Type) : Tot (ghost_ref a)
val dummy_ghost_ref (a: Type) : Tot (ghost_ref a)
let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a)))
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 51, "end_line": 375, "start_col": 0, "start_line": 373 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: Type0 -> Steel.Reference.ghost_ref a
Prims.Tot
[ "total" ]
[]
[ "FStar.Pervasives.coerce_eq", "FStar.Ghost.erased", "Steel.HigherReference.ref", "FStar.Universe.raise_t", "Steel.Reference.ghost_ref", "FStar.Ghost.hide", "Steel.HigherReference.null", "Prims.unit", "Steel.HigherReference.reveal_ghost_ref" ]
[]
false
false
false
true
false
let dummy_ghost_ref a =
H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a)))
false
WhileReify.fst
WhileReify.interpret_exp
val interpret_exp (h: heap) (e: exp) : Tot int
val interpret_exp (h: heap) (e: exp) : Tot int
let interpret_exp (h:heap) (e:exp) : Tot int = reify (interpret_exp_st e) h
{ "file_name": "examples/rel/WhileReify.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 75, "end_line": 80, "start_col": 0, "start_line": 80 }
(* 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 WhileReify open FStar.DM4F.Heap.IntStoreFixed open FStar.DM4F.IntStoreExcFixed module ISFR = FStar.DM4F.IntStoreFixedReader module X = FStar.DM4F.IntStoreExcFixed type binop = | Plus | Minus | Times | Max val interpret_binop : o:binop -> a:int -> b:int -> Tot int let interpret_binop o a b = match o with | Plus -> a + b | Minus -> a - b | Times -> op_Multiply a b | Max -> if a <= b then b else a type exp = | AInt : int -> exp | AVar : id -> exp | AOp : binop -> exp -> exp -> exp (* CH: This is a termination metric (natural number expression) for showing termination of while. Decreasingness and positivity of this termination metric _dynamically_ checked. *) type metric = exp (* Commands -- loops are annotated with metrics *) type com = | Skip : com | Assign : var:id -> term:exp -> com | Seq : first:com -> second:com -> com | If : cond:exp -> then_branch:com -> else_branch:com -> com | While : cond:exp -> body:com -> metric:metric -> com (* TODO : This function is total and does not use exceptions *) (* as such it wouldn't be that surprising that writing it in a *) (* exception free effect helps proving properties about it *) (* The problem is that we then need reifiable lifts from the *) (* exceptionless effect to the exceptionfull one and this not covered yet *) (* by the F* implementation. *) (* val interpret_exp_st : e:exp -> INT_STORE_EXC int (fun s0 p -> forall opt. p (opt, s0)) *) let rec interpret_exp_st (e:exp) (* : INT_STORE_EXC int (fun s0 p -> forall x. p (Some x, s0)) *) : ISFR.ISRNull int = match e with | AInt i -> i | AVar x -> ISFR.read x | AOp o e1 e2 -> let a = interpret_exp_st e1 in let b = interpret_exp_st e2 in interpret_binop o a b
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.DM4F.IntStoreFixedReader.fst.checked", "FStar.DM4F.IntStoreExcFixed.fst.checked", "FStar.DM4F.Heap.IntStoreFixed.fsti.checked" ], "interface_file": false, "source_file": "WhileReify.fst" }
[ { "abbrev": true, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": "X" }, { "abbrev": true, "full_module": "FStar.DM4F.IntStoreFixedReader", "short_module": "ISFR" }, { "abbrev": false, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap.IntStoreFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
h: FStar.DM4F.Heap.IntStoreFixed.heap -> e: WhileReify.exp -> Prims.int
Prims.Tot
[ "total" ]
[]
[ "FStar.DM4F.Heap.IntStoreFixed.heap", "WhileReify.exp", "WhileReify.interpret_exp_st", "Prims.int" ]
[]
false
false
false
true
false
let interpret_exp (h: heap) (e: exp) : Tot int =
reify (interpret_exp_st e) h
false
Steel.Reference.fst
Steel.Reference.ghost_pts_to_witinv
val ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p))
val ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p))
let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y))
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 73, "end_line": 387, "start_col": 0, "start_line": 380 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> p: Steel.FractionalPermission.perm -> FStar.Pervasives.Lemma (ensures Steel.Memory.is_witness_invariant (Steel.Reference.ghost_pts_to_sl r p))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ghost_ref", "Steel.FractionalPermission.perm", "FStar.Classical.forall_intro_3", "Steel.Memory.mem", "Prims.l_imp", "Prims.l_and", "Steel.Memory.interp", "Steel.Reference.ghost_pts_to_sl", "Prims.eq2", "FStar.Classical.move_requires", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern", "Steel.Reference.raise_val_inj", "Steel.HigherReference.ghost_pts_to_witinv", "FStar.Universe.raise_t", "Steel.Memory.is_witness_invariant" ]
[]
false
false
true
false
false
let ghost_pts_to_witinv (#a: Type) (r: ghost_ref a) (p: perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) =
let aux (x y: a) (m: mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y))
false
WhileReify.fst
WhileReify.decr_while
val decr_while : heap -> com -> GTot nat
val decr_while : heap -> com -> GTot nat
let decr_while h c = match c with | While c b v -> interpret_exp' h v | _ -> 0
{ "file_name": "examples/rel/WhileReify.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 10, "end_line": 92, "start_col": 0, "start_line": 89 }
(* 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 WhileReify open FStar.DM4F.Heap.IntStoreFixed open FStar.DM4F.IntStoreExcFixed module ISFR = FStar.DM4F.IntStoreFixedReader module X = FStar.DM4F.IntStoreExcFixed type binop = | Plus | Minus | Times | Max val interpret_binop : o:binop -> a:int -> b:int -> Tot int let interpret_binop o a b = match o with | Plus -> a + b | Minus -> a - b | Times -> op_Multiply a b | Max -> if a <= b then b else a type exp = | AInt : int -> exp | AVar : id -> exp | AOp : binop -> exp -> exp -> exp (* CH: This is a termination metric (natural number expression) for showing termination of while. Decreasingness and positivity of this termination metric _dynamically_ checked. *) type metric = exp (* Commands -- loops are annotated with metrics *) type com = | Skip : com | Assign : var:id -> term:exp -> com | Seq : first:com -> second:com -> com | If : cond:exp -> then_branch:com -> else_branch:com -> com | While : cond:exp -> body:com -> metric:metric -> com (* TODO : This function is total and does not use exceptions *) (* as such it wouldn't be that surprising that writing it in a *) (* exception free effect helps proving properties about it *) (* The problem is that we then need reifiable lifts from the *) (* exceptionless effect to the exceptionfull one and this not covered yet *) (* by the F* implementation. *) (* val interpret_exp_st : e:exp -> INT_STORE_EXC int (fun s0 p -> forall opt. p (opt, s0)) *) let rec interpret_exp_st (e:exp) (* : INT_STORE_EXC int (fun s0 p -> forall x. p (Some x, s0)) *) : ISFR.ISRNull int = match e with | AInt i -> i | AVar x -> ISFR.read x | AOp o e1 e2 -> let a = interpret_exp_st e1 in let b = interpret_exp_st e2 in interpret_binop o a b (* unfold *) let interpret_exp (h:heap) (e:exp) : Tot int = reify (interpret_exp_st e) h let interpret_exp' (h:heap) (e:exp) : Tot nat = let n = interpret_exp h e in if 0 > n then 0 else n (* function used for the decreases clause *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.DM4F.IntStoreFixedReader.fst.checked", "FStar.DM4F.IntStoreExcFixed.fst.checked", "FStar.DM4F.Heap.IntStoreFixed.fsti.checked" ], "interface_file": false, "source_file": "WhileReify.fst" }
[ { "abbrev": true, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": "X" }, { "abbrev": true, "full_module": "FStar.DM4F.IntStoreFixedReader", "short_module": "ISFR" }, { "abbrev": false, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap.IntStoreFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
h: FStar.DM4F.Heap.IntStoreFixed.heap -> c: WhileReify.com -> Prims.GTot Prims.nat
Prims.GTot
[ "sometrivial" ]
[]
[ "FStar.DM4F.Heap.IntStoreFixed.heap", "WhileReify.com", "WhileReify.exp", "WhileReify.metric", "WhileReify.interpret_exp'", "Prims.nat" ]
[]
false
false
false
false
false
let decr_while h c =
match c with | While c b v -> interpret_exp' h v | _ -> 0
false
Steel.Reference.fst
Steel.Reference.ghost_ptrp
val ghost_ptrp (#a: Type0) (r: ghost_ref a) ([@@@smt_fallback] p: perm) : slprop u#1
val ghost_ptrp (#a: Type0) (r: ghost_ref a) ([@@@smt_fallback] p: perm) : slprop u#1
let ghost_ptrp r p = Mem.h_exists (ghost_pts_to_sl r p)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 55, "end_line": 448, "start_col": 0, "start_line": 448 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x) let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) [@@__reduce__] let raise_erased (#a:Type0) (x:erased a) : erased (U.raise_t u#0 u#1 a) = Ghost.hide (U.raise_val (Ghost.reveal x)) let ghost_alloc_pt (#a:Type) (#u:_) (x:erased a) : SteelGhostT (ghost_ref a) u emp (fun r -> ghost_pts_to r full_perm x) = H.ghost_alloc (raise_erased x) let ghost_free_pt r = H.ghost_free r let ghost_share_gen_pt #_ #_ #_ #x r p1 p2 = H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2 let ghost_share_pt (#a:Type) (#u:_) (#p:perm) (#x:erased a) (r:ghost_ref a) = H.ghost_share #_ #_ #_ #(raise_erased x) r let ghost_gather_pt (#a:Type) (#u:_) (#p0 #p1:perm) (#x0 #x1:erased a) (r:ghost_ref a) : SteelGhost unit u (ghost_pts_to r p0 x0 `star` ghost_pts_to r p1 x1) (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0) (requires fun _ -> true) (ensures fun _ _ _ -> x0 == x1) = H.ghost_gather r let ghost_pts_to_injective_eq (#a:_) (#u:_) (#p #q:_) (r:ghost_ref a) (v0 v1:Ghost.erased a) : SteelGhost unit u (ghost_pts_to r p v0 `star` ghost_pts_to r q v1) (fun _ -> ghost_pts_to r p v0 `star` ghost_pts_to r q v0) (requires fun _ -> True) (ensures fun _ _ _ -> v0 == v1) = H.ghost_pts_to_injective_eq #_ #_ #p #q r (raise_erased v0) (raise_erased v1) let ghost_pts_to_perm r = H.ghost_pts_to_perm r let ghost_read_pt #a #u #p #v r = let x = H.ghost_read r in let x' = hide (U.downgrade_val (reveal x)) in rewrite_slprop (H.ghost_pts_to r p x) (ghost_pts_to r p x') (fun _ -> ()); x' let ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a) : SteelGhostT unit u (ghost_pts_to r full_perm v) (fun _ -> ghost_pts_to r full_perm x) = H.ghost_write r (raise_erased x) (* Selector version of ghost pointers *)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> p: Steel.FractionalPermission.perm -> Steel.Memory.slprop
Prims.Tot
[ "total" ]
[]
[ "Steel.Reference.ghost_ref", "Steel.FractionalPermission.perm", "Steel.Memory.h_exists", "Steel.Reference.ghost_pts_to_sl", "Steel.Memory.slprop" ]
[]
false
false
false
true
false
let ghost_ptrp r p =
Mem.h_exists (ghost_pts_to_sl r p)
false
WhileReify.fst
WhileReify.interpret_binop
val interpret_binop : o:binop -> a:int -> b:int -> Tot int
val interpret_binop : o:binop -> a:int -> b:int -> Tot int
let interpret_binop o a b = match o with | Plus -> a + b | Minus -> a - b | Times -> op_Multiply a b | Max -> if a <= b then b else a
{ "file_name": "examples/rel/WhileReify.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 36, "end_line": 35, "start_col": 0, "start_line": 30 }
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module WhileReify open FStar.DM4F.Heap.IntStoreFixed open FStar.DM4F.IntStoreExcFixed module ISFR = FStar.DM4F.IntStoreFixedReader module X = FStar.DM4F.IntStoreExcFixed type binop = | Plus | Minus | Times | Max
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.DM4F.IntStoreFixedReader.fst.checked", "FStar.DM4F.IntStoreExcFixed.fst.checked", "FStar.DM4F.Heap.IntStoreFixed.fsti.checked" ], "interface_file": false, "source_file": "WhileReify.fst" }
[ { "abbrev": true, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": "X" }, { "abbrev": true, "full_module": "FStar.DM4F.IntStoreFixedReader", "short_module": "ISFR" }, { "abbrev": false, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap.IntStoreFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
o: WhileReify.binop -> a: Prims.int -> b: Prims.int -> Prims.int
Prims.Tot
[ "total" ]
[]
[ "WhileReify.binop", "Prims.int", "Prims.op_Addition", "Prims.op_Subtraction", "Prims.op_Multiply", "Prims.op_LessThanOrEqual", "Prims.bool" ]
[]
false
false
false
true
false
let interpret_binop o a b =
match o with | Plus -> a + b | Minus -> a - b | Times -> op_Multiply a b | Max -> if a <= b then b else a
false
WhileReify.fst
WhileReify.interpret_exp'
val interpret_exp' (h: heap) (e: exp) : Tot nat
val interpret_exp' (h: heap) (e: exp) : Tot nat
let interpret_exp' (h:heap) (e:exp) : Tot nat = let n = interpret_exp h e in if 0 > n then 0 else n
{ "file_name": "examples/rel/WhileReify.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 24, "end_line": 85, "start_col": 0, "start_line": 83 }
(* 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 WhileReify open FStar.DM4F.Heap.IntStoreFixed open FStar.DM4F.IntStoreExcFixed module ISFR = FStar.DM4F.IntStoreFixedReader module X = FStar.DM4F.IntStoreExcFixed type binop = | Plus | Minus | Times | Max val interpret_binop : o:binop -> a:int -> b:int -> Tot int let interpret_binop o a b = match o with | Plus -> a + b | Minus -> a - b | Times -> op_Multiply a b | Max -> if a <= b then b else a type exp = | AInt : int -> exp | AVar : id -> exp | AOp : binop -> exp -> exp -> exp (* CH: This is a termination metric (natural number expression) for showing termination of while. Decreasingness and positivity of this termination metric _dynamically_ checked. *) type metric = exp (* Commands -- loops are annotated with metrics *) type com = | Skip : com | Assign : var:id -> term:exp -> com | Seq : first:com -> second:com -> com | If : cond:exp -> then_branch:com -> else_branch:com -> com | While : cond:exp -> body:com -> metric:metric -> com (* TODO : This function is total and does not use exceptions *) (* as such it wouldn't be that surprising that writing it in a *) (* exception free effect helps proving properties about it *) (* The problem is that we then need reifiable lifts from the *) (* exceptionless effect to the exceptionfull one and this not covered yet *) (* by the F* implementation. *) (* val interpret_exp_st : e:exp -> INT_STORE_EXC int (fun s0 p -> forall opt. p (opt, s0)) *) let rec interpret_exp_st (e:exp) (* : INT_STORE_EXC int (fun s0 p -> forall x. p (Some x, s0)) *) : ISFR.ISRNull int = match e with | AInt i -> i | AVar x -> ISFR.read x | AOp o e1 e2 -> let a = interpret_exp_st e1 in let b = interpret_exp_st e2 in interpret_binop o a b (* unfold *) let interpret_exp (h:heap) (e:exp) : Tot int = reify (interpret_exp_st e) h
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.DM4F.IntStoreFixedReader.fst.checked", "FStar.DM4F.IntStoreExcFixed.fst.checked", "FStar.DM4F.Heap.IntStoreFixed.fsti.checked" ], "interface_file": false, "source_file": "WhileReify.fst" }
[ { "abbrev": true, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": "X" }, { "abbrev": true, "full_module": "FStar.DM4F.IntStoreFixedReader", "short_module": "ISFR" }, { "abbrev": false, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap.IntStoreFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
h: FStar.DM4F.Heap.IntStoreFixed.heap -> e: WhileReify.exp -> Prims.nat
Prims.Tot
[ "total" ]
[]
[ "FStar.DM4F.Heap.IntStoreFixed.heap", "WhileReify.exp", "Prims.op_GreaterThan", "Prims.bool", "Prims.nat", "Prims.int", "WhileReify.interpret_exp" ]
[]
false
false
false
true
false
let interpret_exp' (h: heap) (e: exp) : Tot nat =
let n = interpret_exp h e in if 0 > n then 0 else n
false
WhileReify.fst
WhileReify.interpret_exp_st
val interpret_exp_st (e: exp) : ISFR.ISRNull int
val interpret_exp_st (e: exp) : ISFR.ISRNull int
let rec interpret_exp_st (e:exp) (* : INT_STORE_EXC int (fun s0 p -> forall x. p (Some x, s0)) *) : ISFR.ISRNull int = match e with | AInt i -> i | AVar x -> ISFR.read x | AOp o e1 e2 -> let a = interpret_exp_st e1 in let b = interpret_exp_st e2 in interpret_binop o a b
{ "file_name": "examples/rel/WhileReify.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 25, "end_line": 76, "start_col": 0, "start_line": 66 }
(* 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 WhileReify open FStar.DM4F.Heap.IntStoreFixed open FStar.DM4F.IntStoreExcFixed module ISFR = FStar.DM4F.IntStoreFixedReader module X = FStar.DM4F.IntStoreExcFixed type binop = | Plus | Minus | Times | Max val interpret_binop : o:binop -> a:int -> b:int -> Tot int let interpret_binop o a b = match o with | Plus -> a + b | Minus -> a - b | Times -> op_Multiply a b | Max -> if a <= b then b else a type exp = | AInt : int -> exp | AVar : id -> exp | AOp : binop -> exp -> exp -> exp (* CH: This is a termination metric (natural number expression) for showing termination of while. Decreasingness and positivity of this termination metric _dynamically_ checked. *) type metric = exp (* Commands -- loops are annotated with metrics *) type com = | Skip : com | Assign : var:id -> term:exp -> com | Seq : first:com -> second:com -> com | If : cond:exp -> then_branch:com -> else_branch:com -> com | While : cond:exp -> body:com -> metric:metric -> com (* TODO : This function is total and does not use exceptions *) (* as such it wouldn't be that surprising that writing it in a *) (* exception free effect helps proving properties about it *) (* The problem is that we then need reifiable lifts from the *) (* exceptionless effect to the exceptionfull one and this not covered yet *) (* by the F* implementation. *) (* val interpret_exp_st : e:exp -> INT_STORE_EXC int (fun s0 p -> forall opt. p (opt, s0)) *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.DM4F.IntStoreFixedReader.fst.checked", "FStar.DM4F.IntStoreExcFixed.fst.checked", "FStar.DM4F.Heap.IntStoreFixed.fsti.checked" ], "interface_file": false, "source_file": "WhileReify.fst" }
[ { "abbrev": true, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": "X" }, { "abbrev": true, "full_module": "FStar.DM4F.IntStoreFixedReader", "short_module": "ISFR" }, { "abbrev": false, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap.IntStoreFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
e: WhileReify.exp -> FStar.DM4F.IntStoreFixedReader.ISRNull Prims.int
FStar.DM4F.IntStoreFixedReader.ISRNull
[]
[]
[ "WhileReify.exp", "Prims.int", "FStar.DM4F.Heap.IntStoreFixed.id", "FStar.DM4F.IntStoreFixedReader.read", "WhileReify.binop", "WhileReify.interpret_binop", "WhileReify.interpret_exp_st" ]
[ "recursion" ]
false
true
false
false
false
let rec interpret_exp_st (e: exp) : ISFR.ISRNull int =
match e with | AInt i -> i | AVar x -> ISFR.read x | AOp o e1 e2 -> let a = interpret_exp_st e1 in let b = interpret_exp_st e2 in interpret_binop o a b
false
WhileReify.fst
WhileReify.interpret_com
val interpret_com (h0: heap) (c: com) : Tot (option heap)
val interpret_com (h0: heap) (c: com) : Tot (option heap)
let interpret_com (h0:heap) (c:com) : Tot (option heap) = match (* normalize_term *) (reify (interpret_com_st c h0) h0) with | Some (), h -> Some h | None, _ -> None
{ "file_name": "examples/rel/WhileReify.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 19, "end_line": 149, "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 WhileReify open FStar.DM4F.Heap.IntStoreFixed open FStar.DM4F.IntStoreExcFixed module ISFR = FStar.DM4F.IntStoreFixedReader module X = FStar.DM4F.IntStoreExcFixed type binop = | Plus | Minus | Times | Max val interpret_binop : o:binop -> a:int -> b:int -> Tot int let interpret_binop o a b = match o with | Plus -> a + b | Minus -> a - b | Times -> op_Multiply a b | Max -> if a <= b then b else a type exp = | AInt : int -> exp | AVar : id -> exp | AOp : binop -> exp -> exp -> exp (* CH: This is a termination metric (natural number expression) for showing termination of while. Decreasingness and positivity of this termination metric _dynamically_ checked. *) type metric = exp (* Commands -- loops are annotated with metrics *) type com = | Skip : com | Assign : var:id -> term:exp -> com | Seq : first:com -> second:com -> com | If : cond:exp -> then_branch:com -> else_branch:com -> com | While : cond:exp -> body:com -> metric:metric -> com (* TODO : This function is total and does not use exceptions *) (* as such it wouldn't be that surprising that writing it in a *) (* exception free effect helps proving properties about it *) (* The problem is that we then need reifiable lifts from the *) (* exceptionless effect to the exceptionfull one and this not covered yet *) (* by the F* implementation. *) (* val interpret_exp_st : e:exp -> INT_STORE_EXC int (fun s0 p -> forall opt. p (opt, s0)) *) let rec interpret_exp_st (e:exp) (* : INT_STORE_EXC int (fun s0 p -> forall x. p (Some x, s0)) *) : ISFR.ISRNull int = match e with | AInt i -> i | AVar x -> ISFR.read x | AOp o e1 e2 -> let a = interpret_exp_st e1 in let b = interpret_exp_st e2 in interpret_binop o a b (* unfold *) let interpret_exp (h:heap) (e:exp) : Tot int = reify (interpret_exp_st e) h let interpret_exp' (h:heap) (e:exp) : Tot nat = let n = interpret_exp h e in if 0 > n then 0 else n (* function used for the decreases clause *) val decr_while : heap -> com -> GTot nat let decr_while h c = match c with | While c b v -> interpret_exp' h v | _ -> 0 exception OutOfFuel val interpret_com_st : c:com -> h0:heap -> IntStoreExc unit (requires (fun h -> h == h0)) (ensures (fun h _ ho -> h == h0)) (decreases %[c; decr_while h0 c]) let rec interpret_com_st c h0 = match c with | Skip -> () | Assign x e -> let v = interpret_exp_st e in write x v | Seq c1 c2 -> begin let h1 = (X.get()) in interpret_com_st c1 h1; let h2 = (X.get()) in interpret_com_st c2 h2 end | If e ct cf -> let v = interpret_exp_st e in let c = if v = 0 then cf else ct in let h = (X.get()) in interpret_com_st c h | While e body v -> let v0 = interpret_exp_st e in if v0 <> 0 then begin (* let m0 = interpret_exp_st v in *) (* let h = X.get () in *) (* interpret_com_st body h; *) (* let m1 = interpret_exp_st v in *) (* proving recursive terminating relies of interpret_exp not *) (* changing the state? somehow F* can't prove this although *) (* interpret_exp_st has that in the spec! *) let m0 = interpret_exp' h0 v in let h1 = X.get () in interpret_com_st body h1; let h2 = X.get() in let m1 = interpret_exp' h2 v in if m0 > m1 then interpret_com_st c h2 else raise_ () (* OutOfFuel *) end (* TODO : Normalization does not play very well with ensures clauses... *) (* But there is no problem when replacing normalize_term by foobar where *) (* abstract let foobar (#a:Type) (x:a) : a = x *)
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.DM4F.IntStoreFixedReader.fst.checked", "FStar.DM4F.IntStoreExcFixed.fst.checked", "FStar.DM4F.Heap.IntStoreFixed.fsti.checked" ], "interface_file": false, "source_file": "WhileReify.fst" }
[ { "abbrev": true, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": "X" }, { "abbrev": true, "full_module": "FStar.DM4F.IntStoreFixedReader", "short_module": "ISFR" }, { "abbrev": false, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap.IntStoreFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
h0: FStar.DM4F.Heap.IntStoreFixed.heap -> c: WhileReify.com -> FStar.Pervasives.Native.option FStar.DM4F.Heap.IntStoreFixed.heap
Prims.Tot
[ "total" ]
[]
[ "FStar.DM4F.Heap.IntStoreFixed.heap", "WhileReify.com", "WhileReify.interpret_com_st", "Prims.unit", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option" ]
[]
false
false
false
true
false
let interpret_com (h0: heap) (c: com) : Tot (option heap) =
match (reify (interpret_com_st c h0) h0) with | Some (), h -> Some h | None, _ -> None
false
WhileReify.fst
WhileReify.interpret_com_st
val interpret_com_st : c:com -> h0:heap -> IntStoreExc unit (requires (fun h -> h == h0)) (ensures (fun h _ ho -> h == h0)) (decreases %[c; decr_while h0 c])
val interpret_com_st : c:com -> h0:heap -> IntStoreExc unit (requires (fun h -> h == h0)) (ensures (fun h _ ho -> h == h0)) (decreases %[c; decr_while h0 c])
let rec interpret_com_st c h0 = match c with | Skip -> () | Assign x e -> let v = interpret_exp_st e in write x v | Seq c1 c2 -> begin let h1 = (X.get()) in interpret_com_st c1 h1; let h2 = (X.get()) in interpret_com_st c2 h2 end | If e ct cf -> let v = interpret_exp_st e in let c = if v = 0 then cf else ct in let h = (X.get()) in interpret_com_st c h | While e body v -> let v0 = interpret_exp_st e in if v0 <> 0 then begin (* let m0 = interpret_exp_st v in *) (* let h = X.get () in *) (* interpret_com_st body h; *) (* let m1 = interpret_exp_st v in *) (* proving recursive terminating relies of interpret_exp not *) (* changing the state? somehow F* can't prove this although *) (* interpret_exp_st has that in the spec! *) let m0 = interpret_exp' h0 v in let h1 = X.get () in interpret_com_st body h1; let h2 = X.get() in let m1 = interpret_exp' h2 v in if m0 > m1 then interpret_com_st c h2 else raise_ () (* OutOfFuel *) end
{ "file_name": "examples/rel/WhileReify.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 9, "end_line": 138, "start_col": 1, "start_line": 100 }
(* 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 WhileReify open FStar.DM4F.Heap.IntStoreFixed open FStar.DM4F.IntStoreExcFixed module ISFR = FStar.DM4F.IntStoreFixedReader module X = FStar.DM4F.IntStoreExcFixed type binop = | Plus | Minus | Times | Max val interpret_binop : o:binop -> a:int -> b:int -> Tot int let interpret_binop o a b = match o with | Plus -> a + b | Minus -> a - b | Times -> op_Multiply a b | Max -> if a <= b then b else a type exp = | AInt : int -> exp | AVar : id -> exp | AOp : binop -> exp -> exp -> exp (* CH: This is a termination metric (natural number expression) for showing termination of while. Decreasingness and positivity of this termination metric _dynamically_ checked. *) type metric = exp (* Commands -- loops are annotated with metrics *) type com = | Skip : com | Assign : var:id -> term:exp -> com | Seq : first:com -> second:com -> com | If : cond:exp -> then_branch:com -> else_branch:com -> com | While : cond:exp -> body:com -> metric:metric -> com (* TODO : This function is total and does not use exceptions *) (* as such it wouldn't be that surprising that writing it in a *) (* exception free effect helps proving properties about it *) (* The problem is that we then need reifiable lifts from the *) (* exceptionless effect to the exceptionfull one and this not covered yet *) (* by the F* implementation. *) (* val interpret_exp_st : e:exp -> INT_STORE_EXC int (fun s0 p -> forall opt. p (opt, s0)) *) let rec interpret_exp_st (e:exp) (* : INT_STORE_EXC int (fun s0 p -> forall x. p (Some x, s0)) *) : ISFR.ISRNull int = match e with | AInt i -> i | AVar x -> ISFR.read x | AOp o e1 e2 -> let a = interpret_exp_st e1 in let b = interpret_exp_st e2 in interpret_binop o a b (* unfold *) let interpret_exp (h:heap) (e:exp) : Tot int = reify (interpret_exp_st e) h let interpret_exp' (h:heap) (e:exp) : Tot nat = let n = interpret_exp h e in if 0 > n then 0 else n (* function used for the decreases clause *) val decr_while : heap -> com -> GTot nat let decr_while h c = match c with | While c b v -> interpret_exp' h v | _ -> 0 exception OutOfFuel val interpret_com_st : c:com -> h0:heap -> IntStoreExc unit (requires (fun h -> h == h0)) (ensures (fun h _ ho -> h == h0))
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.DM4F.IntStoreFixedReader.fst.checked", "FStar.DM4F.IntStoreExcFixed.fst.checked", "FStar.DM4F.Heap.IntStoreFixed.fsti.checked" ], "interface_file": false, "source_file": "WhileReify.fst" }
[ { "abbrev": true, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": "X" }, { "abbrev": true, "full_module": "FStar.DM4F.IntStoreFixedReader", "short_module": "ISFR" }, { "abbrev": false, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap.IntStoreFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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: WhileReify.com -> h0: FStar.DM4F.Heap.IntStoreFixed.heap -> FStar.DM4F.IntStoreExcFixed.IntStoreExc Prims.unit
FStar.DM4F.IntStoreExcFixed.IntStoreExc
[ "" ]
[]
[ "WhileReify.com", "FStar.DM4F.Heap.IntStoreFixed.heap", "Prims.unit", "FStar.DM4F.Heap.IntStoreFixed.id", "WhileReify.exp", "FStar.DM4F.IntStoreExcFixed.write", "Prims.int", "WhileReify.interpret_exp_st", "WhileReify.interpret_com_st", "FStar.DM4F.IntStoreExcFixed.get", "Prims.op_Equality", "Prims.bool", "WhileReify.metric", "Prims.op_disEquality", "Prims.op_GreaterThan", "FStar.DM4F.IntStoreExcFixed.raise_", "Prims.nat", "WhileReify.interpret_exp'" ]
[ "recursion" ]
false
true
false
false
false
let rec interpret_com_st c h0 =
match c with | Skip -> () | Assign x e -> let v = interpret_exp_st e in write x v | Seq c1 c2 -> let h1 = (X.get ()) in interpret_com_st c1 h1; let h2 = (X.get ()) in interpret_com_st c2 h2 | If e ct cf -> let v = interpret_exp_st e in let c = if v = 0 then cf else ct in let h = (X.get ()) in interpret_com_st c h | While e body v -> let v0 = interpret_exp_st e in if v0 <> 0 then let m0 = interpret_exp' h0 v in let h1 = X.get () in interpret_com_st body h1; let h2 = X.get () in let m1 = interpret_exp' h2 v in if m0 > m1 then interpret_com_st c h2 else raise_ ()
false
WhileReify.fst
WhileReify.bidule2
val bidule2 : Prims.unit
let bidule2 = assert (interpret_exp (create 3) (AOp Plus (AVar (to_id 7)) (AInt 5)) = 8)
{ "file_name": "examples/rel/WhileReify.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 88, "end_line": 153, "start_col": 0, "start_line": 153 }
(* 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 WhileReify open FStar.DM4F.Heap.IntStoreFixed open FStar.DM4F.IntStoreExcFixed module ISFR = FStar.DM4F.IntStoreFixedReader module X = FStar.DM4F.IntStoreExcFixed type binop = | Plus | Minus | Times | Max val interpret_binop : o:binop -> a:int -> b:int -> Tot int let interpret_binop o a b = match o with | Plus -> a + b | Minus -> a - b | Times -> op_Multiply a b | Max -> if a <= b then b else a type exp = | AInt : int -> exp | AVar : id -> exp | AOp : binop -> exp -> exp -> exp (* CH: This is a termination metric (natural number expression) for showing termination of while. Decreasingness and positivity of this termination metric _dynamically_ checked. *) type metric = exp (* Commands -- loops are annotated with metrics *) type com = | Skip : com | Assign : var:id -> term:exp -> com | Seq : first:com -> second:com -> com | If : cond:exp -> then_branch:com -> else_branch:com -> com | While : cond:exp -> body:com -> metric:metric -> com (* TODO : This function is total and does not use exceptions *) (* as such it wouldn't be that surprising that writing it in a *) (* exception free effect helps proving properties about it *) (* The problem is that we then need reifiable lifts from the *) (* exceptionless effect to the exceptionfull one and this not covered yet *) (* by the F* implementation. *) (* val interpret_exp_st : e:exp -> INT_STORE_EXC int (fun s0 p -> forall opt. p (opt, s0)) *) let rec interpret_exp_st (e:exp) (* : INT_STORE_EXC int (fun s0 p -> forall x. p (Some x, s0)) *) : ISFR.ISRNull int = match e with | AInt i -> i | AVar x -> ISFR.read x | AOp o e1 e2 -> let a = interpret_exp_st e1 in let b = interpret_exp_st e2 in interpret_binop o a b (* unfold *) let interpret_exp (h:heap) (e:exp) : Tot int = reify (interpret_exp_st e) h let interpret_exp' (h:heap) (e:exp) : Tot nat = let n = interpret_exp h e in if 0 > n then 0 else n (* function used for the decreases clause *) val decr_while : heap -> com -> GTot nat let decr_while h c = match c with | While c b v -> interpret_exp' h v | _ -> 0 exception OutOfFuel val interpret_com_st : c:com -> h0:heap -> IntStoreExc unit (requires (fun h -> h == h0)) (ensures (fun h _ ho -> h == h0)) (decreases %[c; decr_while h0 c]) let rec interpret_com_st c h0 = match c with | Skip -> () | Assign x e -> let v = interpret_exp_st e in write x v | Seq c1 c2 -> begin let h1 = (X.get()) in interpret_com_st c1 h1; let h2 = (X.get()) in interpret_com_st c2 h2 end | If e ct cf -> let v = interpret_exp_st e in let c = if v = 0 then cf else ct in let h = (X.get()) in interpret_com_st c h | While e body v -> let v0 = interpret_exp_st e in if v0 <> 0 then begin (* let m0 = interpret_exp_st v in *) (* let h = X.get () in *) (* interpret_com_st body h; *) (* let m1 = interpret_exp_st v in *) (* proving recursive terminating relies of interpret_exp not *) (* changing the state? somehow F* can't prove this although *) (* interpret_exp_st has that in the spec! *) let m0 = interpret_exp' h0 v in let h1 = X.get () in interpret_com_st body h1; let h2 = X.get() in let m1 = interpret_exp' h2 v in if m0 > m1 then interpret_com_st c h2 else raise_ () (* OutOfFuel *) end (* TODO : Normalization does not play very well with ensures clauses... *) (* But there is no problem when replacing normalize_term by foobar where *) (* abstract let foobar (#a:Type) (x:a) : a = x *) (* unfold *) let interpret_com (h0:heap) (c:com) : Tot (option heap) = match (* normalize_term *) (reify (interpret_com_st c h0) h0) with | Some (), h -> Some h | None, _ -> None
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.DM4F.IntStoreFixedReader.fst.checked", "FStar.DM4F.IntStoreExcFixed.fst.checked", "FStar.DM4F.Heap.IntStoreFixed.fsti.checked" ], "interface_file": false, "source_file": "WhileReify.fst" }
[ { "abbrev": true, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": "X" }, { "abbrev": true, "full_module": "FStar.DM4F.IntStoreFixedReader", "short_module": "ISFR" }, { "abbrev": false, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap.IntStoreFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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._assert", "Prims.b2t", "Prims.op_Equality", "Prims.int", "WhileReify.interpret_exp", "FStar.DM4F.Heap.IntStoreFixed.create", "WhileReify.AOp", "WhileReify.Plus", "WhileReify.AVar", "FStar.DM4F.Heap.IntStoreFixed.to_id", "WhileReify.AInt" ]
[]
false
false
false
true
false
let bidule2 =
assert (interpret_exp (create 3) (AOp Plus (AVar (to_id 7)) (AInt 5)) = 8)
false
WhileReify.fst
WhileReify.bidule
val bidule : Prims.unit
let bidule = assert (reify (interpret_exp_st (AOp Plus (AVar (to_id 7)) (AInt 5))) (create 3) = 8)
{ "file_name": "examples/rel/WhileReify.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
{ "end_col": 98, "end_line": 152, "start_col": 0, "start_line": 152 }
(* 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 WhileReify open FStar.DM4F.Heap.IntStoreFixed open FStar.DM4F.IntStoreExcFixed module ISFR = FStar.DM4F.IntStoreFixedReader module X = FStar.DM4F.IntStoreExcFixed type binop = | Plus | Minus | Times | Max val interpret_binop : o:binop -> a:int -> b:int -> Tot int let interpret_binop o a b = match o with | Plus -> a + b | Minus -> a - b | Times -> op_Multiply a b | Max -> if a <= b then b else a type exp = | AInt : int -> exp | AVar : id -> exp | AOp : binop -> exp -> exp -> exp (* CH: This is a termination metric (natural number expression) for showing termination of while. Decreasingness and positivity of this termination metric _dynamically_ checked. *) type metric = exp (* Commands -- loops are annotated with metrics *) type com = | Skip : com | Assign : var:id -> term:exp -> com | Seq : first:com -> second:com -> com | If : cond:exp -> then_branch:com -> else_branch:com -> com | While : cond:exp -> body:com -> metric:metric -> com (* TODO : This function is total and does not use exceptions *) (* as such it wouldn't be that surprising that writing it in a *) (* exception free effect helps proving properties about it *) (* The problem is that we then need reifiable lifts from the *) (* exceptionless effect to the exceptionfull one and this not covered yet *) (* by the F* implementation. *) (* val interpret_exp_st : e:exp -> INT_STORE_EXC int (fun s0 p -> forall opt. p (opt, s0)) *) let rec interpret_exp_st (e:exp) (* : INT_STORE_EXC int (fun s0 p -> forall x. p (Some x, s0)) *) : ISFR.ISRNull int = match e with | AInt i -> i | AVar x -> ISFR.read x | AOp o e1 e2 -> let a = interpret_exp_st e1 in let b = interpret_exp_st e2 in interpret_binop o a b (* unfold *) let interpret_exp (h:heap) (e:exp) : Tot int = reify (interpret_exp_st e) h let interpret_exp' (h:heap) (e:exp) : Tot nat = let n = interpret_exp h e in if 0 > n then 0 else n (* function used for the decreases clause *) val decr_while : heap -> com -> GTot nat let decr_while h c = match c with | While c b v -> interpret_exp' h v | _ -> 0 exception OutOfFuel val interpret_com_st : c:com -> h0:heap -> IntStoreExc unit (requires (fun h -> h == h0)) (ensures (fun h _ ho -> h == h0)) (decreases %[c; decr_while h0 c]) let rec interpret_com_st c h0 = match c with | Skip -> () | Assign x e -> let v = interpret_exp_st e in write x v | Seq c1 c2 -> begin let h1 = (X.get()) in interpret_com_st c1 h1; let h2 = (X.get()) in interpret_com_st c2 h2 end | If e ct cf -> let v = interpret_exp_st e in let c = if v = 0 then cf else ct in let h = (X.get()) in interpret_com_st c h | While e body v -> let v0 = interpret_exp_st e in if v0 <> 0 then begin (* let m0 = interpret_exp_st v in *) (* let h = X.get () in *) (* interpret_com_st body h; *) (* let m1 = interpret_exp_st v in *) (* proving recursive terminating relies of interpret_exp not *) (* changing the state? somehow F* can't prove this although *) (* interpret_exp_st has that in the spec! *) let m0 = interpret_exp' h0 v in let h1 = X.get () in interpret_com_st body h1; let h2 = X.get() in let m1 = interpret_exp' h2 v in if m0 > m1 then interpret_com_st c h2 else raise_ () (* OutOfFuel *) end (* TODO : Normalization does not play very well with ensures clauses... *) (* But there is no problem when replacing normalize_term by foobar where *) (* abstract let foobar (#a:Type) (x:a) : a = x *) (* unfold *) let interpret_com (h0:heap) (c:com) : Tot (option heap) = match (* normalize_term *) (reify (interpret_com_st c h0) h0) with | Some (), h -> Some h | None, _ -> None
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.DM4F.IntStoreFixedReader.fst.checked", "FStar.DM4F.IntStoreExcFixed.fst.checked", "FStar.DM4F.Heap.IntStoreFixed.fsti.checked" ], "interface_file": false, "source_file": "WhileReify.fst" }
[ { "abbrev": true, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": "X" }, { "abbrev": true, "full_module": "FStar.DM4F.IntStoreFixedReader", "short_module": "ISFR" }, { "abbrev": false, "full_module": "FStar.DM4F.IntStoreExcFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.DM4F.Heap.IntStoreFixed", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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._assert", "Prims.b2t", "Prims.op_Equality", "Prims.int", "WhileReify.interpret_exp_st", "WhileReify.AOp", "WhileReify.Plus", "WhileReify.AVar", "FStar.DM4F.Heap.IntStoreFixed.to_id", "WhileReify.AInt", "FStar.DM4F.Heap.IntStoreFixed.create" ]
[]
false
false
false
true
false
let bidule =
assert (reify (interpret_exp_st (AOp Plus (AVar (to_id 7)) (AInt 5))) (create 3) = 8)
false
Hacl.Bignum.Addition.fst
Hacl.Bignum.Addition.bn_sub_eq_len_u64
val bn_sub_eq_len_u64 (aLen: size_t) : bn_sub_eq_len_st U64 aLen
val bn_sub_eq_len_u64 (aLen: size_t) : bn_sub_eq_len_st U64 aLen
let bn_sub_eq_len_u64 (aLen:size_t) : bn_sub_eq_len_st U64 aLen = bn_sub_eq_len aLen
{ "file_name": "code/bignum/Hacl.Bignum.Addition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 84, "end_line": 105, "start_col": 0, "start_line": 105 }
module Hacl.Bignum.Addition open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Hacl.Bignum.Definitions open Hacl.Bignum.Base open Hacl.Impl.Lib open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module B = LowStar.Buffer module S = Hacl.Spec.Bignum.Addition module LSeq = Lib.Sequence module SL = Hacl.Spec.Lib #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val bn_sub_carry: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> c_in:carry t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub_carry (as_seq h0 a) c_in in c_out == c /\ as_seq h1 res == r)) let bn_sub_carry #t aLen a c_in res = push_frame (); let c = create 1ul c_in in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_carry_f (as_seq h a) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 (uint #t 0) res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1 ); let res = c.(0ul) in pop_frame (); res inline_for_extraction noextract let bn_sub_eq_len_st (t:limb_t) (aLen:size_t) = a:lbignum t aLen -> b:lbignum t aLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ eq_or_disjoint a b /\ eq_or_disjoint a res /\ eq_or_disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = SL.generate_elems (v aLen) (v aLen) (S.bn_sub_f (as_seq h0 a) (as_seq h0 b)) (uint #t 0) in c_out == c /\ as_seq h1 res == r)) inline_for_extraction noextract val bn_sub_eq_len: #t:limb_t -> aLen:size_t -> bn_sub_eq_len_st t aLen let bn_sub_eq_len #t aLen a b res = push_frame (); let c = create 1ul (uint #t 0) in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_f (as_seq h a) (as_seq h b) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let t2 = b.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 t2 res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1; lemma_eq_disjoint aLen aLen 1ul res b c i h0 h1 ); let res = c.(0ul) in pop_frame (); res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Lib.fst.checked", "Hacl.Spec.Bignum.Addition.fst.checked", "Hacl.Impl.Lib.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Addition.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Lib", "short_module": "SL" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Addition", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Lib", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
aLen: Lib.IntTypes.size_t -> Hacl.Bignum.Addition.bn_sub_eq_len_st Lib.IntTypes.U64 aLen
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.size_t", "Hacl.Bignum.Addition.bn_sub_eq_len", "Lib.IntTypes.U64", "Hacl.Bignum.Addition.bn_sub_eq_len_st" ]
[]
false
false
false
false
false
let bn_sub_eq_len_u64 (aLen: size_t) : bn_sub_eq_len_st U64 aLen =
bn_sub_eq_len aLen
false
Hacl.Bignum.Addition.fst
Hacl.Bignum.Addition.bn_sub_eq_len_u32
val bn_sub_eq_len_u32 (aLen: size_t) : bn_sub_eq_len_st U32 aLen
val bn_sub_eq_len_u32 (aLen: size_t) : bn_sub_eq_len_st U32 aLen
let bn_sub_eq_len_u32 (aLen:size_t) : bn_sub_eq_len_st U32 aLen = bn_sub_eq_len aLen
{ "file_name": "code/bignum/Hacl.Bignum.Addition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 84, "end_line": 104, "start_col": 0, "start_line": 104 }
module Hacl.Bignum.Addition open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Hacl.Bignum.Definitions open Hacl.Bignum.Base open Hacl.Impl.Lib open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module B = LowStar.Buffer module S = Hacl.Spec.Bignum.Addition module LSeq = Lib.Sequence module SL = Hacl.Spec.Lib #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val bn_sub_carry: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> c_in:carry t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub_carry (as_seq h0 a) c_in in c_out == c /\ as_seq h1 res == r)) let bn_sub_carry #t aLen a c_in res = push_frame (); let c = create 1ul c_in in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_carry_f (as_seq h a) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 (uint #t 0) res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1 ); let res = c.(0ul) in pop_frame (); res inline_for_extraction noextract let bn_sub_eq_len_st (t:limb_t) (aLen:size_t) = a:lbignum t aLen -> b:lbignum t aLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ eq_or_disjoint a b /\ eq_or_disjoint a res /\ eq_or_disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = SL.generate_elems (v aLen) (v aLen) (S.bn_sub_f (as_seq h0 a) (as_seq h0 b)) (uint #t 0) in c_out == c /\ as_seq h1 res == r)) inline_for_extraction noextract val bn_sub_eq_len: #t:limb_t -> aLen:size_t -> bn_sub_eq_len_st t aLen let bn_sub_eq_len #t aLen a b res = push_frame (); let c = create 1ul (uint #t 0) in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_f (as_seq h a) (as_seq h b) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let t2 = b.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 t2 res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1; lemma_eq_disjoint aLen aLen 1ul res b c i h0 h1 ); let res = c.(0ul) in pop_frame (); res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Lib.fst.checked", "Hacl.Spec.Bignum.Addition.fst.checked", "Hacl.Impl.Lib.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Addition.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Lib", "short_module": "SL" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Addition", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Lib", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
aLen: Lib.IntTypes.size_t -> Hacl.Bignum.Addition.bn_sub_eq_len_st Lib.IntTypes.U32 aLen
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.size_t", "Hacl.Bignum.Addition.bn_sub_eq_len", "Lib.IntTypes.U32", "Hacl.Bignum.Addition.bn_sub_eq_len_st" ]
[]
false
false
false
false
false
let bn_sub_eq_len_u32 (aLen: size_t) : bn_sub_eq_len_st U32 aLen =
bn_sub_eq_len aLen
false
Steel.Reference.fst
Steel.Reference.intro_ghost_vptr_lemma
val intro_ghost_vptr_lemma (#a: Type) (r: ghost_ref a) (p: perm) (v: erased a) (m: mem) : Lemma (requires interp (ghost_pts_to_sl r p v) m) (ensures interp (ghost_ptrp r p) m /\ ghost_ptrp_sel r p m == reveal v)
val intro_ghost_vptr_lemma (#a: Type) (r: ghost_ref a) (p: perm) (v: erased a) (m: mem) : Lemma (requires interp (ghost_pts_to_sl r p v) m) (ensures interp (ghost_ptrp r p) m /\ ghost_ptrp_sel r p m == reveal v)
let intro_ghost_vptr_lemma (#a:Type) (r:ghost_ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ghost_pts_to_sl r p v) m) (ensures interp (ghost_ptrp r p) m /\ ghost_ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (ghost_pts_to_sl r p) m; ghost_pts_to_witinv r p
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 27, "end_line": 482, "start_col": 0, "start_line": 478 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x) let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) [@@__reduce__] let raise_erased (#a:Type0) (x:erased a) : erased (U.raise_t u#0 u#1 a) = Ghost.hide (U.raise_val (Ghost.reveal x)) let ghost_alloc_pt (#a:Type) (#u:_) (x:erased a) : SteelGhostT (ghost_ref a) u emp (fun r -> ghost_pts_to r full_perm x) = H.ghost_alloc (raise_erased x) let ghost_free_pt r = H.ghost_free r let ghost_share_gen_pt #_ #_ #_ #x r p1 p2 = H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2 let ghost_share_pt (#a:Type) (#u:_) (#p:perm) (#x:erased a) (r:ghost_ref a) = H.ghost_share #_ #_ #_ #(raise_erased x) r let ghost_gather_pt (#a:Type) (#u:_) (#p0 #p1:perm) (#x0 #x1:erased a) (r:ghost_ref a) : SteelGhost unit u (ghost_pts_to r p0 x0 `star` ghost_pts_to r p1 x1) (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0) (requires fun _ -> true) (ensures fun _ _ _ -> x0 == x1) = H.ghost_gather r let ghost_pts_to_injective_eq (#a:_) (#u:_) (#p #q:_) (r:ghost_ref a) (v0 v1:Ghost.erased a) : SteelGhost unit u (ghost_pts_to r p v0 `star` ghost_pts_to r q v1) (fun _ -> ghost_pts_to r p v0 `star` ghost_pts_to r q v0) (requires fun _ -> True) (ensures fun _ _ _ -> v0 == v1) = H.ghost_pts_to_injective_eq #_ #_ #p #q r (raise_erased v0) (raise_erased v1) let ghost_pts_to_perm r = H.ghost_pts_to_perm r let ghost_read_pt #a #u #p #v r = let x = H.ghost_read r in let x' = hide (U.downgrade_val (reveal x)) in rewrite_slprop (H.ghost_pts_to r p x) (ghost_pts_to r p x') (fun _ -> ()); x' let ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a) : SteelGhostT unit u (ghost_pts_to r full_perm v) (fun _ -> ghost_pts_to r full_perm x) = H.ghost_write r (raise_erased x) (* Selector version of ghost pointers *) let ghost_ptrp r p = Mem.h_exists (ghost_pts_to_sl r p) val ghost_ptr_sel' (#a:Type0) (r: ghost_ref a) (p: perm) : selector' a (ghost_ptrp r p) let ghost_ptr_sel' #a r p = fun h -> id_elim_exists #a (ghost_pts_to_sl r p) h let ghost_ptr_sel_depends_only_on (#a:Type0) (r:ghost_ref a) (p: perm) (m0:Mem.hmem (ghost_ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (Mem.join m0 m1)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (Mem.join m0 m1) let ghost_ptr_sel_depends_only_on_core (#a:Type0) (r:ghost_ref a) (p: perm) (m0:Mem.hmem (ghost_ptrp r p)) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (core_mem m0)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (core_mem m0) let ghost_ptrp_sel r p = Classical.forall_intro_2 (ghost_ptr_sel_depends_only_on r p); Classical.forall_intro (ghost_ptr_sel_depends_only_on_core r p); ghost_ptr_sel' r p let ghost_ptrp_sel_interp #a r p m = ghost_pts_to_witinv r p
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> p: Steel.FractionalPermission.perm -> v: FStar.Ghost.erased a -> m: Steel.Memory.mem -> FStar.Pervasives.Lemma (requires Steel.Memory.interp (Steel.Reference.ghost_pts_to_sl r p (FStar.Ghost.reveal v)) m) (ensures Steel.Memory.interp (Steel.Reference.ghost_ptrp r p) m /\ Steel.Reference.ghost_ptrp_sel r p m == FStar.Ghost.reveal v)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ghost_ref", "Steel.FractionalPermission.perm", "FStar.Ghost.erased", "Steel.Memory.mem", "Steel.Reference.ghost_pts_to_witinv", "Prims.unit", "Steel.Memory.intro_h_exists", "FStar.Ghost.reveal", "Steel.Reference.ghost_pts_to_sl", "Steel.Memory.interp", "Prims.squash", "Prims.l_and", "Steel.Reference.ghost_ptrp", "Prims.eq2", "Steel.Reference.ghost_ptrp_sel", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let intro_ghost_vptr_lemma (#a: Type) (r: ghost_ref a) (p: perm) (v: erased a) (m: mem) : Lemma (requires interp (ghost_pts_to_sl r p v) m) (ensures interp (ghost_ptrp r p) m /\ ghost_ptrp_sel r p m == reveal v) =
Mem.intro_h_exists (reveal v) (ghost_pts_to_sl r p) m; ghost_pts_to_witinv r p
false
Hacl.Bignum.Addition.fst
Hacl.Bignum.Addition.bn_add_eq_len_u32
val bn_add_eq_len_u32 (aLen: size_t) : bn_add_eq_len_st U32 aLen
val bn_add_eq_len_u32 (aLen: size_t) : bn_add_eq_len_st U32 aLen
let bn_add_eq_len_u32 (aLen:size_t) : bn_add_eq_len_st U32 aLen = bn_add_eq_len aLen
{ "file_name": "code/bignum/Hacl.Bignum.Addition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 84, "end_line": 261, "start_col": 0, "start_line": 261 }
module Hacl.Bignum.Addition open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Hacl.Bignum.Definitions open Hacl.Bignum.Base open Hacl.Impl.Lib open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module B = LowStar.Buffer module S = Hacl.Spec.Bignum.Addition module LSeq = Lib.Sequence module SL = Hacl.Spec.Lib #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val bn_sub_carry: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> c_in:carry t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub_carry (as_seq h0 a) c_in in c_out == c /\ as_seq h1 res == r)) let bn_sub_carry #t aLen a c_in res = push_frame (); let c = create 1ul c_in in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_carry_f (as_seq h a) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 (uint #t 0) res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1 ); let res = c.(0ul) in pop_frame (); res inline_for_extraction noextract let bn_sub_eq_len_st (t:limb_t) (aLen:size_t) = a:lbignum t aLen -> b:lbignum t aLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ eq_or_disjoint a b /\ eq_or_disjoint a res /\ eq_or_disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = SL.generate_elems (v aLen) (v aLen) (S.bn_sub_f (as_seq h0 a) (as_seq h0 b)) (uint #t 0) in c_out == c /\ as_seq h1 res == r)) inline_for_extraction noextract val bn_sub_eq_len: #t:limb_t -> aLen:size_t -> bn_sub_eq_len_st t aLen let bn_sub_eq_len #t aLen a b res = push_frame (); let c = create 1ul (uint #t 0) in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_f (as_seq h a) (as_seq h b) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let t2 = b.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 t2 res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1; lemma_eq_disjoint aLen aLen 1ul res b c i h0 h1 ); let res = c.(0ul) in pop_frame (); res let bn_sub_eq_len_u32 (aLen:size_t) : bn_sub_eq_len_st U32 aLen = bn_sub_eq_len aLen let bn_sub_eq_len_u64 (aLen:size_t) : bn_sub_eq_len_st U64 aLen = bn_sub_eq_len aLen inline_for_extraction noextract let bn_sub_eq_len_u (#t:limb_t) (aLen:size_t) : bn_sub_eq_len_st t aLen = match t with | U32 -> bn_sub_eq_len_u32 aLen | U64 -> bn_sub_eq_len_u64 aLen inline_for_extraction noextract val bn_sub: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> bLen:size_t{v bLen <= v aLen} -> b:lbignum t bLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ disjoint a b /\ eq_or_disjoint a res /\ disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub (as_seq h0 a) (as_seq h0 b) in c_out == c /\ as_seq h1 res == r)) let bn_sub #t aLen a bLen b res = let h0 = ST.get () in let a0 = sub a 0ul bLen in let res0 = sub res 0ul bLen in let h1 = ST.get () in let c0 = bn_sub_eq_len bLen a0 b res0 in let h1 = ST.get () in if bLen <. aLen then begin [@inline_let] let rLen = aLen -! bLen in let a1 = sub a bLen rLen in let res1 = sub res bLen rLen in let c1 = bn_sub_carry rLen a1 c0 res1 in let h2 = ST.get () in LSeq.lemma_concat2 (v bLen) (as_seq h1 res0) (v rLen) (as_seq h2 res1) (as_seq h2 res); c1 end else c0 inline_for_extraction noextract val bn_sub1: #t:limb_t -> aLen:size_t{0 < v aLen} -> a:lbignum t aLen -> b1:limb t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub1 (as_seq h0 a) b1 in c_out == c /\ as_seq h1 res == r)) let bn_sub1 #t aLen a b1 res = let c0 = subborrow_st (uint #t 0) a.(0ul) b1 (sub res 0ul 1ul) in let h0 = ST.get () in LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 1) (LSeq.create 1 (LSeq.index (as_seq h0 res) 0)); if 1ul <. aLen then begin [@inline_let] let rLen = aLen -! 1ul in let a1 = sub a 1ul rLen in let res1 = sub res 1ul rLen in let c1 = bn_sub_carry rLen a1 c0 res1 in let h = ST.get () in LSeq.lemma_concat2 1 (LSeq.sub (as_seq h0 res) 0 1) (v rLen) (as_seq h res1) (as_seq h res); c1 end else c0 inline_for_extraction noextract val bn_add_carry: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> c_in:carry t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_add_carry (as_seq h0 a) c_in in c_out == c /\ as_seq h1 res == r)) let bn_add_carry #t aLen a c_in res = push_frame (); let c = create 1ul c_in in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_add_carry_f (as_seq h a) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let res_i = sub res i 1ul in c.(0ul) <- addcarry_st c.(0ul) t1 (uint #t 0) res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1 ); let res = c.(0ul) in pop_frame (); res inline_for_extraction noextract let bn_add_eq_len_st (t:limb_t) (aLen:size_t) = a:lbignum t aLen -> b:lbignum t aLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ eq_or_disjoint a b /\ eq_or_disjoint a res /\ eq_or_disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = SL.generate_elems (v aLen) (v aLen) (S.bn_add_f (as_seq h0 a) (as_seq h0 b)) (uint #t 0) in c_out == c /\ as_seq h1 res == r)) inline_for_extraction noextract val bn_add_eq_len: #t:limb_t -> aLen:size_t -> bn_add_eq_len_st t aLen let bn_add_eq_len #t aLen a b res = push_frame (); let c = create 1ul (uint #t 0) in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_add_f (as_seq h a) (as_seq h b) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let t2 = b.(i) in let res_i = sub res i 1ul in c.(0ul) <- addcarry_st c.(0ul) t1 t2 res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1; lemma_eq_disjoint aLen aLen 1ul res b c i h0 h1 ); let res = c.(0ul) in pop_frame (); res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Lib.fst.checked", "Hacl.Spec.Bignum.Addition.fst.checked", "Hacl.Impl.Lib.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Addition.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Lib", "short_module": "SL" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Addition", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Lib", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
aLen: Lib.IntTypes.size_t -> Hacl.Bignum.Addition.bn_add_eq_len_st Lib.IntTypes.U32 aLen
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.size_t", "Hacl.Bignum.Addition.bn_add_eq_len", "Lib.IntTypes.U32", "Hacl.Bignum.Addition.bn_add_eq_len_st" ]
[]
false
false
false
false
false
let bn_add_eq_len_u32 (aLen: size_t) : bn_add_eq_len_st U32 aLen =
bn_add_eq_len aLen
false
Steel.Reference.fst
Steel.Reference.ghost_ptrp_sel_interp
val ghost_ptrp_sel_interp (#a:Type0) (r:ghost_ref a) (p: perm) (m:mem) : Lemma (requires interp (ghost_ptrp r p) m) (ensures interp (ghost_pts_to_sl r p (ghost_ptrp_sel r p m)) m)
val ghost_ptrp_sel_interp (#a:Type0) (r:ghost_ref a) (p: perm) (m:mem) : Lemma (requires interp (ghost_ptrp r p) m) (ensures interp (ghost_pts_to_sl r p (ghost_ptrp_sel r p m)) m)
let ghost_ptrp_sel_interp #a r p m = ghost_pts_to_witinv r p
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 60, "end_line": 475, "start_col": 0, "start_line": 475 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x) let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) [@@__reduce__] let raise_erased (#a:Type0) (x:erased a) : erased (U.raise_t u#0 u#1 a) = Ghost.hide (U.raise_val (Ghost.reveal x)) let ghost_alloc_pt (#a:Type) (#u:_) (x:erased a) : SteelGhostT (ghost_ref a) u emp (fun r -> ghost_pts_to r full_perm x) = H.ghost_alloc (raise_erased x) let ghost_free_pt r = H.ghost_free r let ghost_share_gen_pt #_ #_ #_ #x r p1 p2 = H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2 let ghost_share_pt (#a:Type) (#u:_) (#p:perm) (#x:erased a) (r:ghost_ref a) = H.ghost_share #_ #_ #_ #(raise_erased x) r let ghost_gather_pt (#a:Type) (#u:_) (#p0 #p1:perm) (#x0 #x1:erased a) (r:ghost_ref a) : SteelGhost unit u (ghost_pts_to r p0 x0 `star` ghost_pts_to r p1 x1) (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0) (requires fun _ -> true) (ensures fun _ _ _ -> x0 == x1) = H.ghost_gather r let ghost_pts_to_injective_eq (#a:_) (#u:_) (#p #q:_) (r:ghost_ref a) (v0 v1:Ghost.erased a) : SteelGhost unit u (ghost_pts_to r p v0 `star` ghost_pts_to r q v1) (fun _ -> ghost_pts_to r p v0 `star` ghost_pts_to r q v0) (requires fun _ -> True) (ensures fun _ _ _ -> v0 == v1) = H.ghost_pts_to_injective_eq #_ #_ #p #q r (raise_erased v0) (raise_erased v1) let ghost_pts_to_perm r = H.ghost_pts_to_perm r let ghost_read_pt #a #u #p #v r = let x = H.ghost_read r in let x' = hide (U.downgrade_val (reveal x)) in rewrite_slprop (H.ghost_pts_to r p x) (ghost_pts_to r p x') (fun _ -> ()); x' let ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a) : SteelGhostT unit u (ghost_pts_to r full_perm v) (fun _ -> ghost_pts_to r full_perm x) = H.ghost_write r (raise_erased x) (* Selector version of ghost pointers *) let ghost_ptrp r p = Mem.h_exists (ghost_pts_to_sl r p) val ghost_ptr_sel' (#a:Type0) (r: ghost_ref a) (p: perm) : selector' a (ghost_ptrp r p) let ghost_ptr_sel' #a r p = fun h -> id_elim_exists #a (ghost_pts_to_sl r p) h let ghost_ptr_sel_depends_only_on (#a:Type0) (r:ghost_ref a) (p: perm) (m0:Mem.hmem (ghost_ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (Mem.join m0 m1)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (Mem.join m0 m1) let ghost_ptr_sel_depends_only_on_core (#a:Type0) (r:ghost_ref a) (p: perm) (m0:Mem.hmem (ghost_ptrp r p)) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (core_mem m0)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (core_mem m0) let ghost_ptrp_sel r p = Classical.forall_intro_2 (ghost_ptr_sel_depends_only_on r p); Classical.forall_intro (ghost_ptr_sel_depends_only_on_core r p); ghost_ptr_sel' r p
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> p: Steel.FractionalPermission.perm -> m: Steel.Memory.mem -> FStar.Pervasives.Lemma (requires Steel.Memory.interp (Steel.Reference.ghost_ptrp r p) m) (ensures Steel.Memory.interp (Steel.Reference.ghost_pts_to_sl r p (Steel.Reference.ghost_ptrp_sel r p m)) m)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ghost_ref", "Steel.FractionalPermission.perm", "Steel.Memory.mem", "Steel.Reference.ghost_pts_to_witinv", "Prims.unit" ]
[]
true
false
true
false
false
let ghost_ptrp_sel_interp #a r p m =
ghost_pts_to_witinv r p
false
Steel.Reference.fst
Steel.Reference.vptrp_not_null
val vptrp_not_null (#opened: _) (#a: Type) (r: ref a) (p: perm) : SteelGhost unit opened (vptrp r p) (fun _ -> vptrp r p) (fun _ -> True) (fun h0 _ h1 -> h0 (vptrp r p) == h1 (vptrp r p) /\ is_null r == false )
val vptrp_not_null (#opened: _) (#a: Type) (r: ref a) (p: perm) : SteelGhost unit opened (vptrp r p) (fun _ -> vptrp r p) (fun _ -> True) (fun h0 _ h1 -> h0 (vptrp r p) == h1 (vptrp r p) /\ is_null r == false )
let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 53, "end_line": 366, "start_col": 0, "start_line": 359 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ref a -> p: Steel.FractionalPermission.perm -> Steel.Effect.Atomic.SteelGhost Prims.unit
Steel.Effect.Atomic.SteelGhost
[]
[]
[ "Steel.Memory.inames", "Steel.Reference.ref", "Steel.FractionalPermission.perm", "Steel.Effect.Atomic.change_slprop_rel", "Steel.Reference.vptrp", "Steel.Effect.Common.normal", "Steel.Effect.Common.t_of", "Prims.l_and", "Prims.eq2", "Prims.bool", "Steel.Reference.is_null", "Prims.prop", "Steel.Memory.mem", "Steel.Reference.pts_to_not_null", "Steel.Reference.ptrp_sel", "Prims.unit" ]
[]
false
true
false
false
false
let vptrp_not_null #opened #a r p =
change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m)
false
Steel.Reference.fst
Steel.Reference.ghost_ptrp_sel
val ghost_ptrp_sel (#a:Type0) (r:ghost_ref a) (p: perm) : selector a (ghost_ptrp r p)
val ghost_ptrp_sel (#a:Type0) (r:ghost_ref a) (p: perm) : selector a (ghost_ptrp r p)
let ghost_ptrp_sel r p = Classical.forall_intro_2 (ghost_ptr_sel_depends_only_on r p); Classical.forall_intro (ghost_ptr_sel_depends_only_on_core r p); ghost_ptr_sel' r p
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 20, "end_line": 473, "start_col": 0, "start_line": 470 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x) let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) [@@__reduce__] let raise_erased (#a:Type0) (x:erased a) : erased (U.raise_t u#0 u#1 a) = Ghost.hide (U.raise_val (Ghost.reveal x)) let ghost_alloc_pt (#a:Type) (#u:_) (x:erased a) : SteelGhostT (ghost_ref a) u emp (fun r -> ghost_pts_to r full_perm x) = H.ghost_alloc (raise_erased x) let ghost_free_pt r = H.ghost_free r let ghost_share_gen_pt #_ #_ #_ #x r p1 p2 = H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2 let ghost_share_pt (#a:Type) (#u:_) (#p:perm) (#x:erased a) (r:ghost_ref a) = H.ghost_share #_ #_ #_ #(raise_erased x) r let ghost_gather_pt (#a:Type) (#u:_) (#p0 #p1:perm) (#x0 #x1:erased a) (r:ghost_ref a) : SteelGhost unit u (ghost_pts_to r p0 x0 `star` ghost_pts_to r p1 x1) (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0) (requires fun _ -> true) (ensures fun _ _ _ -> x0 == x1) = H.ghost_gather r let ghost_pts_to_injective_eq (#a:_) (#u:_) (#p #q:_) (r:ghost_ref a) (v0 v1:Ghost.erased a) : SteelGhost unit u (ghost_pts_to r p v0 `star` ghost_pts_to r q v1) (fun _ -> ghost_pts_to r p v0 `star` ghost_pts_to r q v0) (requires fun _ -> True) (ensures fun _ _ _ -> v0 == v1) = H.ghost_pts_to_injective_eq #_ #_ #p #q r (raise_erased v0) (raise_erased v1) let ghost_pts_to_perm r = H.ghost_pts_to_perm r let ghost_read_pt #a #u #p #v r = let x = H.ghost_read r in let x' = hide (U.downgrade_val (reveal x)) in rewrite_slprop (H.ghost_pts_to r p x) (ghost_pts_to r p x') (fun _ -> ()); x' let ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a) : SteelGhostT unit u (ghost_pts_to r full_perm v) (fun _ -> ghost_pts_to r full_perm x) = H.ghost_write r (raise_erased x) (* Selector version of ghost pointers *) let ghost_ptrp r p = Mem.h_exists (ghost_pts_to_sl r p) val ghost_ptr_sel' (#a:Type0) (r: ghost_ref a) (p: perm) : selector' a (ghost_ptrp r p) let ghost_ptr_sel' #a r p = fun h -> id_elim_exists #a (ghost_pts_to_sl r p) h let ghost_ptr_sel_depends_only_on (#a:Type0) (r:ghost_ref a) (p: perm) (m0:Mem.hmem (ghost_ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (Mem.join m0 m1)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (Mem.join m0 m1) let ghost_ptr_sel_depends_only_on_core (#a:Type0) (r:ghost_ref a) (p: perm) (m0:Mem.hmem (ghost_ptrp r p)) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (core_mem m0)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (core_mem m0)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> p: Steel.FractionalPermission.perm -> Steel.Effect.Common.selector a (Steel.Reference.ghost_ptrp r p)
Prims.Tot
[ "total" ]
[]
[ "Steel.Reference.ghost_ref", "Steel.FractionalPermission.perm", "Steel.Reference.ghost_ptr_sel'", "Prims.unit", "FStar.Classical.forall_intro", "Steel.Memory.hmem", "Steel.Reference.ghost_ptrp", "Prims.eq2", "Steel.Memory.core_mem", "Steel.Reference.ghost_ptr_sel_depends_only_on_core", "FStar.Classical.forall_intro_2", "Steel.Memory.mem", "Steel.Memory.disjoint", "Steel.Memory.join", "Steel.Reference.ghost_ptr_sel_depends_only_on", "Steel.Effect.Common.selector" ]
[]
false
false
false
false
false
let ghost_ptrp_sel r p =
Classical.forall_intro_2 (ghost_ptr_sel_depends_only_on r p); Classical.forall_intro (ghost_ptr_sel_depends_only_on_core r p); ghost_ptr_sel' r p
false
Steel.Reference.fst
Steel.Reference.ghost_ptr_sel'
val ghost_ptr_sel' (#a:Type0) (r: ghost_ref a) (p: perm) : selector' a (ghost_ptrp r p)
val ghost_ptr_sel' (#a:Type0) (r: ghost_ref a) (p: perm) : selector' a (ghost_ptrp r p)
let ghost_ptr_sel' #a r p = fun h -> id_elim_exists #a (ghost_pts_to_sl r p) h
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 78, "end_line": 451, "start_col": 0, "start_line": 451 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x) let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) [@@__reduce__] let raise_erased (#a:Type0) (x:erased a) : erased (U.raise_t u#0 u#1 a) = Ghost.hide (U.raise_val (Ghost.reveal x)) let ghost_alloc_pt (#a:Type) (#u:_) (x:erased a) : SteelGhostT (ghost_ref a) u emp (fun r -> ghost_pts_to r full_perm x) = H.ghost_alloc (raise_erased x) let ghost_free_pt r = H.ghost_free r let ghost_share_gen_pt #_ #_ #_ #x r p1 p2 = H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2 let ghost_share_pt (#a:Type) (#u:_) (#p:perm) (#x:erased a) (r:ghost_ref a) = H.ghost_share #_ #_ #_ #(raise_erased x) r let ghost_gather_pt (#a:Type) (#u:_) (#p0 #p1:perm) (#x0 #x1:erased a) (r:ghost_ref a) : SteelGhost unit u (ghost_pts_to r p0 x0 `star` ghost_pts_to r p1 x1) (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0) (requires fun _ -> true) (ensures fun _ _ _ -> x0 == x1) = H.ghost_gather r let ghost_pts_to_injective_eq (#a:_) (#u:_) (#p #q:_) (r:ghost_ref a) (v0 v1:Ghost.erased a) : SteelGhost unit u (ghost_pts_to r p v0 `star` ghost_pts_to r q v1) (fun _ -> ghost_pts_to r p v0 `star` ghost_pts_to r q v0) (requires fun _ -> True) (ensures fun _ _ _ -> v0 == v1) = H.ghost_pts_to_injective_eq #_ #_ #p #q r (raise_erased v0) (raise_erased v1) let ghost_pts_to_perm r = H.ghost_pts_to_perm r let ghost_read_pt #a #u #p #v r = let x = H.ghost_read r in let x' = hide (U.downgrade_val (reveal x)) in rewrite_slprop (H.ghost_pts_to r p x) (ghost_pts_to r p x') (fun _ -> ()); x' let ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a) : SteelGhostT unit u (ghost_pts_to r full_perm v) (fun _ -> ghost_pts_to r full_perm x) = H.ghost_write r (raise_erased x) (* Selector version of ghost pointers *) let ghost_ptrp r p = Mem.h_exists (ghost_pts_to_sl r p)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> p: Steel.FractionalPermission.perm -> Steel.Effect.Common.selector' a (Steel.Reference.ghost_ptrp r p)
Prims.Tot
[ "total" ]
[]
[ "Steel.Reference.ghost_ref", "Steel.FractionalPermission.perm", "Steel.Memory.hmem", "Steel.Reference.ghost_ptrp", "FStar.Ghost.reveal", "Steel.Memory.id_elim_exists", "Steel.Reference.ghost_pts_to_sl" ]
[]
false
false
false
false
false
let ghost_ptr_sel' #a r p =
fun h -> id_elim_exists #a (ghost_pts_to_sl r p) h
false
Spec.Agile.HKDF.fst
Spec.Agile.HKDF.a_spec
val a_spec : a: Spec.Hash.Definitions.fixed_len_alg -> i: FStar.Integers.nat -> Type0
let a_spec (a:fixed_len_alg) (i:nat) = Seq.lseq uint8 (if i = 0 then 0 else hash_length a)
{ "file_name": "specs/Spec.Agile.HKDF.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 53, "end_line": 38, "start_col": 0, "start_line": 37 }
module Spec.Agile.HKDF open FStar.Integers open Spec.Hash.Definitions /// FUNCTIONAL SPECIFICATION: /// /// * extraction is just HMAC using the salt as key and the input /// keying materials as text. /// /// * expansion does its own formatting of input key materials. open FStar.Seq #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" let extract = Spec.Agile.HMAC.hmac module Seq = Lib.Sequence open Lib.IntTypes /// HKDF-Expand(PRK, info, L) /// /// N = ceil(L/HashLen) /// T = T(1) | T(2) | T(3) | ... | T(N) /// OKM = first L octets of T /// /// where: /// T(0) = empty string (zero length) /// T(1) = HMAC-Hash(PRK, T(0) | info | 0x01) /// T(2) = HMAC-Hash(PRK, T(1) | info | 0x02) /// T(3) = HMAC-Hash(PRK, T(2) | info | 0x03) /// /// See https://tools.ietf.org/html/rfc5869#section-2.3
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HMAC.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Integers.fst.checked" ], "interface_file": true, "source_file": "Spec.Agile.HKDF.fst" }
[ { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "Seq" }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Integers", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.fixed_len_alg -> i: FStar.Integers.nat -> Type0
Prims.Tot
[ "total" ]
[]
[ "Spec.Hash.Definitions.fixed_len_alg", "FStar.Integers.nat", "Lib.Sequence.lseq", "Lib.IntTypes.uint8", "Prims.op_Equality", "Prims.int", "Prims.bool", "Spec.Hash.Definitions.hash_length", "Lib.IntTypes.size_nat" ]
[]
false
false
false
true
true
let a_spec (a: fixed_len_alg) (i: nat) =
Seq.lseq uint8 (if i = 0 then 0 else hash_length a)
false
Spec.Agile.HKDF.fst
Spec.Agile.HKDF.extract
val extract: a: fixed_len_alg -> key: bytes -> data: bytes -> Pure (lbytes (hash_length a)) (requires Spec.Agile.HMAC.keysized a (Seq.length key) /\ extract_ikm_length_pred a (Seq.length data)) (ensures fun _ -> True)
val extract: a: fixed_len_alg -> key: bytes -> data: bytes -> Pure (lbytes (hash_length a)) (requires Spec.Agile.HMAC.keysized a (Seq.length key) /\ extract_ikm_length_pred a (Seq.length data)) (ensures fun _ -> True)
let extract = Spec.Agile.HMAC.hmac
{ "file_name": "specs/Spec.Agile.HKDF.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 34, "end_line": 17, "start_col": 0, "start_line": 17 }
module Spec.Agile.HKDF open FStar.Integers open Spec.Hash.Definitions /// FUNCTIONAL SPECIFICATION: /// /// * extraction is just HMAC using the salt as key and the input /// keying materials as text. /// /// * expansion does its own formatting of input key materials. open FStar.Seq #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50"
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HMAC.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Integers.fst.checked" ], "interface_file": true, "source_file": "Spec.Agile.HKDF.fst" }
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Integers", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.fixed_len_alg -> key: Spec.Hash.Definitions.bytes -> data: Spec.Hash.Definitions.bytes -> Prims.Pure (Spec.Agile.HKDF.lbytes (Spec.Hash.Definitions.hash_length a))
Prims.Pure
[]
[]
[ "Spec.Agile.HMAC.hmac" ]
[]
false
false
false
false
false
let extract =
Spec.Agile.HMAC.hmac
false
Steel.Reference.fst
Steel.Reference.ghost_ptr_sel_depends_only_on
val ghost_ptr_sel_depends_only_on (#a: Type0) (r: ghost_ref a) (p: perm) (m0: Mem.hmem (ghost_ptrp r p)) (m1: mem{disjoint m0 m1}) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (Mem.join m0 m1))
val ghost_ptr_sel_depends_only_on (#a: Type0) (r: ghost_ref a) (p: perm) (m0: Mem.hmem (ghost_ptrp r p)) (m1: mem{disjoint m0 m1}) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (Mem.join m0 m1))
let ghost_ptr_sel_depends_only_on (#a:Type0) (r:ghost_ref a) (p: perm) (m0:Mem.hmem (ghost_ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (Mem.join m0 m1)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (Mem.join m0 m1)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 54, "end_line": 460, "start_col": 0, "start_line": 453 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x) let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) [@@__reduce__] let raise_erased (#a:Type0) (x:erased a) : erased (U.raise_t u#0 u#1 a) = Ghost.hide (U.raise_val (Ghost.reveal x)) let ghost_alloc_pt (#a:Type) (#u:_) (x:erased a) : SteelGhostT (ghost_ref a) u emp (fun r -> ghost_pts_to r full_perm x) = H.ghost_alloc (raise_erased x) let ghost_free_pt r = H.ghost_free r let ghost_share_gen_pt #_ #_ #_ #x r p1 p2 = H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2 let ghost_share_pt (#a:Type) (#u:_) (#p:perm) (#x:erased a) (r:ghost_ref a) = H.ghost_share #_ #_ #_ #(raise_erased x) r let ghost_gather_pt (#a:Type) (#u:_) (#p0 #p1:perm) (#x0 #x1:erased a) (r:ghost_ref a) : SteelGhost unit u (ghost_pts_to r p0 x0 `star` ghost_pts_to r p1 x1) (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0) (requires fun _ -> true) (ensures fun _ _ _ -> x0 == x1) = H.ghost_gather r let ghost_pts_to_injective_eq (#a:_) (#u:_) (#p #q:_) (r:ghost_ref a) (v0 v1:Ghost.erased a) : SteelGhost unit u (ghost_pts_to r p v0 `star` ghost_pts_to r q v1) (fun _ -> ghost_pts_to r p v0 `star` ghost_pts_to r q v0) (requires fun _ -> True) (ensures fun _ _ _ -> v0 == v1) = H.ghost_pts_to_injective_eq #_ #_ #p #q r (raise_erased v0) (raise_erased v1) let ghost_pts_to_perm r = H.ghost_pts_to_perm r let ghost_read_pt #a #u #p #v r = let x = H.ghost_read r in let x' = hide (U.downgrade_val (reveal x)) in rewrite_slprop (H.ghost_pts_to r p x) (ghost_pts_to r p x') (fun _ -> ()); x' let ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a) : SteelGhostT unit u (ghost_pts_to r full_perm v) (fun _ -> ghost_pts_to r full_perm x) = H.ghost_write r (raise_erased x) (* Selector version of ghost pointers *) let ghost_ptrp r p = Mem.h_exists (ghost_pts_to_sl r p) val ghost_ptr_sel' (#a:Type0) (r: ghost_ref a) (p: perm) : selector' a (ghost_ptrp r p) let ghost_ptr_sel' #a r p = fun h -> id_elim_exists #a (ghost_pts_to_sl r p) h
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> p: Steel.FractionalPermission.perm -> m0: Steel.Memory.hmem (Steel.Reference.ghost_ptrp r p) -> m1: Steel.Memory.mem{Steel.Memory.disjoint m0 m1} -> FStar.Pervasives.Lemma (ensures Steel.Reference.ghost_ptr_sel' r p m0 == Steel.Reference.ghost_ptr_sel' r p (Steel.Memory.join m0 m1))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ghost_ref", "Steel.FractionalPermission.perm", "Steel.Memory.hmem", "Steel.Reference.ghost_ptrp", "Steel.Memory.mem", "Steel.Memory.disjoint", "Steel.Memory.elim_wi", "Steel.Reference.ghost_pts_to_sl", "Steel.Memory.join", "Prims.unit", "Steel.Reference.ghost_pts_to_witinv", "FStar.Ghost.reveal", "Steel.Memory.id_elim_exists", "Prims.l_True", "Prims.squash", "Prims.eq2", "Steel.Reference.ghost_ptr_sel'", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let ghost_ptr_sel_depends_only_on (#a: Type0) (r: ghost_ref a) (p: perm) (m0: Mem.hmem (ghost_ptrp r p)) (m1: mem{disjoint m0 m1}) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (Mem.join m0 m1)) =
let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (Mem.join m0 m1)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (Mem.join m0 m1)
false
Hacl.Bignum.Addition.fst
Hacl.Bignum.Addition.bn_add_eq_len_u64
val bn_add_eq_len_u64 (aLen: size_t) : bn_add_eq_len_st U64 aLen
val bn_add_eq_len_u64 (aLen: size_t) : bn_add_eq_len_st U64 aLen
let bn_add_eq_len_u64 (aLen:size_t) : bn_add_eq_len_st U64 aLen = bn_add_eq_len aLen
{ "file_name": "code/bignum/Hacl.Bignum.Addition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 84, "end_line": 262, "start_col": 0, "start_line": 262 }
module Hacl.Bignum.Addition open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Hacl.Bignum.Definitions open Hacl.Bignum.Base open Hacl.Impl.Lib open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module B = LowStar.Buffer module S = Hacl.Spec.Bignum.Addition module LSeq = Lib.Sequence module SL = Hacl.Spec.Lib #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val bn_sub_carry: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> c_in:carry t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub_carry (as_seq h0 a) c_in in c_out == c /\ as_seq h1 res == r)) let bn_sub_carry #t aLen a c_in res = push_frame (); let c = create 1ul c_in in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_carry_f (as_seq h a) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 (uint #t 0) res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1 ); let res = c.(0ul) in pop_frame (); res inline_for_extraction noextract let bn_sub_eq_len_st (t:limb_t) (aLen:size_t) = a:lbignum t aLen -> b:lbignum t aLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ eq_or_disjoint a b /\ eq_or_disjoint a res /\ eq_or_disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = SL.generate_elems (v aLen) (v aLen) (S.bn_sub_f (as_seq h0 a) (as_seq h0 b)) (uint #t 0) in c_out == c /\ as_seq h1 res == r)) inline_for_extraction noextract val bn_sub_eq_len: #t:limb_t -> aLen:size_t -> bn_sub_eq_len_st t aLen let bn_sub_eq_len #t aLen a b res = push_frame (); let c = create 1ul (uint #t 0) in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_f (as_seq h a) (as_seq h b) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let t2 = b.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 t2 res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1; lemma_eq_disjoint aLen aLen 1ul res b c i h0 h1 ); let res = c.(0ul) in pop_frame (); res let bn_sub_eq_len_u32 (aLen:size_t) : bn_sub_eq_len_st U32 aLen = bn_sub_eq_len aLen let bn_sub_eq_len_u64 (aLen:size_t) : bn_sub_eq_len_st U64 aLen = bn_sub_eq_len aLen inline_for_extraction noextract let bn_sub_eq_len_u (#t:limb_t) (aLen:size_t) : bn_sub_eq_len_st t aLen = match t with | U32 -> bn_sub_eq_len_u32 aLen | U64 -> bn_sub_eq_len_u64 aLen inline_for_extraction noextract val bn_sub: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> bLen:size_t{v bLen <= v aLen} -> b:lbignum t bLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ disjoint a b /\ eq_or_disjoint a res /\ disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub (as_seq h0 a) (as_seq h0 b) in c_out == c /\ as_seq h1 res == r)) let bn_sub #t aLen a bLen b res = let h0 = ST.get () in let a0 = sub a 0ul bLen in let res0 = sub res 0ul bLen in let h1 = ST.get () in let c0 = bn_sub_eq_len bLen a0 b res0 in let h1 = ST.get () in if bLen <. aLen then begin [@inline_let] let rLen = aLen -! bLen in let a1 = sub a bLen rLen in let res1 = sub res bLen rLen in let c1 = bn_sub_carry rLen a1 c0 res1 in let h2 = ST.get () in LSeq.lemma_concat2 (v bLen) (as_seq h1 res0) (v rLen) (as_seq h2 res1) (as_seq h2 res); c1 end else c0 inline_for_extraction noextract val bn_sub1: #t:limb_t -> aLen:size_t{0 < v aLen} -> a:lbignum t aLen -> b1:limb t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub1 (as_seq h0 a) b1 in c_out == c /\ as_seq h1 res == r)) let bn_sub1 #t aLen a b1 res = let c0 = subborrow_st (uint #t 0) a.(0ul) b1 (sub res 0ul 1ul) in let h0 = ST.get () in LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 1) (LSeq.create 1 (LSeq.index (as_seq h0 res) 0)); if 1ul <. aLen then begin [@inline_let] let rLen = aLen -! 1ul in let a1 = sub a 1ul rLen in let res1 = sub res 1ul rLen in let c1 = bn_sub_carry rLen a1 c0 res1 in let h = ST.get () in LSeq.lemma_concat2 1 (LSeq.sub (as_seq h0 res) 0 1) (v rLen) (as_seq h res1) (as_seq h res); c1 end else c0 inline_for_extraction noextract val bn_add_carry: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> c_in:carry t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_add_carry (as_seq h0 a) c_in in c_out == c /\ as_seq h1 res == r)) let bn_add_carry #t aLen a c_in res = push_frame (); let c = create 1ul c_in in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_add_carry_f (as_seq h a) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let res_i = sub res i 1ul in c.(0ul) <- addcarry_st c.(0ul) t1 (uint #t 0) res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1 ); let res = c.(0ul) in pop_frame (); res inline_for_extraction noextract let bn_add_eq_len_st (t:limb_t) (aLen:size_t) = a:lbignum t aLen -> b:lbignum t aLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ eq_or_disjoint a b /\ eq_or_disjoint a res /\ eq_or_disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = SL.generate_elems (v aLen) (v aLen) (S.bn_add_f (as_seq h0 a) (as_seq h0 b)) (uint #t 0) in c_out == c /\ as_seq h1 res == r)) inline_for_extraction noextract val bn_add_eq_len: #t:limb_t -> aLen:size_t -> bn_add_eq_len_st t aLen let bn_add_eq_len #t aLen a b res = push_frame (); let c = create 1ul (uint #t 0) in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_add_f (as_seq h a) (as_seq h b) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let t2 = b.(i) in let res_i = sub res i 1ul in c.(0ul) <- addcarry_st c.(0ul) t1 t2 res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1; lemma_eq_disjoint aLen aLen 1ul res b c i h0 h1 ); let res = c.(0ul) in pop_frame (); res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Lib.fst.checked", "Hacl.Spec.Bignum.Addition.fst.checked", "Hacl.Impl.Lib.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Addition.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Lib", "short_module": "SL" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Addition", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Lib", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
aLen: Lib.IntTypes.size_t -> Hacl.Bignum.Addition.bn_add_eq_len_st Lib.IntTypes.U64 aLen
Prims.Tot
[ "total" ]
[]
[ "Lib.IntTypes.size_t", "Hacl.Bignum.Addition.bn_add_eq_len", "Lib.IntTypes.U64", "Hacl.Bignum.Addition.bn_add_eq_len_st" ]
[]
false
false
false
false
false
let bn_add_eq_len_u64 (aLen: size_t) : bn_add_eq_len_st U64 aLen =
bn_add_eq_len aLen
false
Steel.Reference.fst
Steel.Reference.elim_ghost_vptr_lemma
val elim_ghost_vptr_lemma (#a: Type) (r: ghost_ref a) (p: perm) (v: erased a) (m: mem) : Lemma (requires interp (ghost_ptrp r p) m /\ ghost_ptrp_sel r p m == reveal v) (ensures interp (ghost_pts_to_sl r p v) m)
val elim_ghost_vptr_lemma (#a: Type) (r: ghost_ref a) (p: perm) (v: erased a) (m: mem) : Lemma (requires interp (ghost_ptrp r p) m /\ ghost_ptrp_sel r p m == reveal v) (ensures interp (ghost_pts_to_sl r p v) m)
let elim_ghost_vptr_lemma (#a:Type) (r:ghost_ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ghost_ptrp r p) m /\ ghost_ptrp_sel r p m == reveal v) (ensures interp (ghost_pts_to_sl r p v) m) = Mem.elim_h_exists (ghost_pts_to_sl r p) m; ghost_pts_to_witinv r p
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 27, "end_line": 488, "start_col": 0, "start_line": 484 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x) let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) [@@__reduce__] let raise_erased (#a:Type0) (x:erased a) : erased (U.raise_t u#0 u#1 a) = Ghost.hide (U.raise_val (Ghost.reveal x)) let ghost_alloc_pt (#a:Type) (#u:_) (x:erased a) : SteelGhostT (ghost_ref a) u emp (fun r -> ghost_pts_to r full_perm x) = H.ghost_alloc (raise_erased x) let ghost_free_pt r = H.ghost_free r let ghost_share_gen_pt #_ #_ #_ #x r p1 p2 = H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2 let ghost_share_pt (#a:Type) (#u:_) (#p:perm) (#x:erased a) (r:ghost_ref a) = H.ghost_share #_ #_ #_ #(raise_erased x) r let ghost_gather_pt (#a:Type) (#u:_) (#p0 #p1:perm) (#x0 #x1:erased a) (r:ghost_ref a) : SteelGhost unit u (ghost_pts_to r p0 x0 `star` ghost_pts_to r p1 x1) (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0) (requires fun _ -> true) (ensures fun _ _ _ -> x0 == x1) = H.ghost_gather r let ghost_pts_to_injective_eq (#a:_) (#u:_) (#p #q:_) (r:ghost_ref a) (v0 v1:Ghost.erased a) : SteelGhost unit u (ghost_pts_to r p v0 `star` ghost_pts_to r q v1) (fun _ -> ghost_pts_to r p v0 `star` ghost_pts_to r q v0) (requires fun _ -> True) (ensures fun _ _ _ -> v0 == v1) = H.ghost_pts_to_injective_eq #_ #_ #p #q r (raise_erased v0) (raise_erased v1) let ghost_pts_to_perm r = H.ghost_pts_to_perm r let ghost_read_pt #a #u #p #v r = let x = H.ghost_read r in let x' = hide (U.downgrade_val (reveal x)) in rewrite_slprop (H.ghost_pts_to r p x) (ghost_pts_to r p x') (fun _ -> ()); x' let ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a) : SteelGhostT unit u (ghost_pts_to r full_perm v) (fun _ -> ghost_pts_to r full_perm x) = H.ghost_write r (raise_erased x) (* Selector version of ghost pointers *) let ghost_ptrp r p = Mem.h_exists (ghost_pts_to_sl r p) val ghost_ptr_sel' (#a:Type0) (r: ghost_ref a) (p: perm) : selector' a (ghost_ptrp r p) let ghost_ptr_sel' #a r p = fun h -> id_elim_exists #a (ghost_pts_to_sl r p) h let ghost_ptr_sel_depends_only_on (#a:Type0) (r:ghost_ref a) (p: perm) (m0:Mem.hmem (ghost_ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (Mem.join m0 m1)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (Mem.join m0 m1) let ghost_ptr_sel_depends_only_on_core (#a:Type0) (r:ghost_ref a) (p: perm) (m0:Mem.hmem (ghost_ptrp r p)) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (core_mem m0)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (core_mem m0) let ghost_ptrp_sel r p = Classical.forall_intro_2 (ghost_ptr_sel_depends_only_on r p); Classical.forall_intro (ghost_ptr_sel_depends_only_on_core r p); ghost_ptr_sel' r p let ghost_ptrp_sel_interp #a r p m = ghost_pts_to_witinv r p let intro_ghost_vptr_lemma (#a:Type) (r:ghost_ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ghost_pts_to_sl r p v) m) (ensures interp (ghost_ptrp r p) m /\ ghost_ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (ghost_pts_to_sl r p) m; ghost_pts_to_witinv r p
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> p: Steel.FractionalPermission.perm -> v: FStar.Ghost.erased a -> m: Steel.Memory.mem -> FStar.Pervasives.Lemma (requires Steel.Memory.interp (Steel.Reference.ghost_ptrp r p) m /\ Steel.Reference.ghost_ptrp_sel r p m == FStar.Ghost.reveal v) (ensures Steel.Memory.interp (Steel.Reference.ghost_pts_to_sl r p (FStar.Ghost.reveal v)) m)
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ghost_ref", "Steel.FractionalPermission.perm", "FStar.Ghost.erased", "Steel.Memory.mem", "Steel.Reference.ghost_pts_to_witinv", "Prims.unit", "Steel.Memory.elim_h_exists", "Steel.Reference.ghost_pts_to_sl", "Prims.l_and", "Steel.Memory.interp", "Steel.Reference.ghost_ptrp", "Prims.eq2", "Steel.Reference.ghost_ptrp_sel", "FStar.Ghost.reveal", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let elim_ghost_vptr_lemma (#a: Type) (r: ghost_ref a) (p: perm) (v: erased a) (m: mem) : Lemma (requires interp (ghost_ptrp r p) m /\ ghost_ptrp_sel r p m == reveal v) (ensures interp (ghost_pts_to_sl r p v) m) =
Mem.elim_h_exists (ghost_pts_to_sl r p) m; ghost_pts_to_witinv r p
false
Steel.Reference.fst
Steel.Reference.ghost_free_pt
val ghost_free_pt (#a:Type0) (#u:_) (#v:erased a) (r:ghost_ref a) : SteelGhostT unit u (ghost_pts_to r full_perm v) (fun _ -> emp)
val ghost_free_pt (#a:Type0) (#u:_) (#v:erased a) (r:ghost_ref a) : SteelGhostT unit u (ghost_pts_to r full_perm v) (fun _ -> emp)
let ghost_free_pt r = H.ghost_free r
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 36, "end_line": 400, "start_col": 0, "start_line": 400 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x) let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) [@@__reduce__] let raise_erased (#a:Type0) (x:erased a) : erased (U.raise_t u#0 u#1 a) = Ghost.hide (U.raise_val (Ghost.reveal x)) let ghost_alloc_pt (#a:Type) (#u:_) (x:erased a) : SteelGhostT (ghost_ref a) u emp (fun r -> ghost_pts_to r full_perm x) = H.ghost_alloc (raise_erased x)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> Steel.Effect.Atomic.SteelGhostT Prims.unit
Steel.Effect.Atomic.SteelGhostT
[]
[]
[ "Steel.Memory.inames", "FStar.Ghost.erased", "Steel.Reference.ghost_ref", "Steel.HigherReference.ghost_free", "FStar.Universe.raise_t", "FStar.Ghost.hide", "FStar.Universe.raise_val", "FStar.Ghost.reveal", "Prims.unit" ]
[]
false
true
false
false
false
let ghost_free_pt r =
H.ghost_free r
false
Steel.Reference.fst
Steel.Reference.ghost_ptr_sel_depends_only_on_core
val ghost_ptr_sel_depends_only_on_core (#a: Type0) (r: ghost_ref a) (p: perm) (m0: Mem.hmem (ghost_ptrp r p)) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (core_mem m0))
val ghost_ptr_sel_depends_only_on_core (#a: Type0) (r: ghost_ref a) (p: perm) (m0: Mem.hmem (ghost_ptrp r p)) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (core_mem m0))
let ghost_ptr_sel_depends_only_on_core (#a:Type0) (r:ghost_ref a) (p: perm) (m0:Mem.hmem (ghost_ptrp r p)) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (core_mem m0)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (core_mem m0)
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 51, "end_line": 468, "start_col": 0, "start_line": 462 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x) let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) [@@__reduce__] let raise_erased (#a:Type0) (x:erased a) : erased (U.raise_t u#0 u#1 a) = Ghost.hide (U.raise_val (Ghost.reveal x)) let ghost_alloc_pt (#a:Type) (#u:_) (x:erased a) : SteelGhostT (ghost_ref a) u emp (fun r -> ghost_pts_to r full_perm x) = H.ghost_alloc (raise_erased x) let ghost_free_pt r = H.ghost_free r let ghost_share_gen_pt #_ #_ #_ #x r p1 p2 = H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2 let ghost_share_pt (#a:Type) (#u:_) (#p:perm) (#x:erased a) (r:ghost_ref a) = H.ghost_share #_ #_ #_ #(raise_erased x) r let ghost_gather_pt (#a:Type) (#u:_) (#p0 #p1:perm) (#x0 #x1:erased a) (r:ghost_ref a) : SteelGhost unit u (ghost_pts_to r p0 x0 `star` ghost_pts_to r p1 x1) (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0) (requires fun _ -> true) (ensures fun _ _ _ -> x0 == x1) = H.ghost_gather r let ghost_pts_to_injective_eq (#a:_) (#u:_) (#p #q:_) (r:ghost_ref a) (v0 v1:Ghost.erased a) : SteelGhost unit u (ghost_pts_to r p v0 `star` ghost_pts_to r q v1) (fun _ -> ghost_pts_to r p v0 `star` ghost_pts_to r q v0) (requires fun _ -> True) (ensures fun _ _ _ -> v0 == v1) = H.ghost_pts_to_injective_eq #_ #_ #p #q r (raise_erased v0) (raise_erased v1) let ghost_pts_to_perm r = H.ghost_pts_to_perm r let ghost_read_pt #a #u #p #v r = let x = H.ghost_read r in let x' = hide (U.downgrade_val (reveal x)) in rewrite_slprop (H.ghost_pts_to r p x) (ghost_pts_to r p x') (fun _ -> ()); x' let ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a) : SteelGhostT unit u (ghost_pts_to r full_perm v) (fun _ -> ghost_pts_to r full_perm x) = H.ghost_write r (raise_erased x) (* Selector version of ghost pointers *) let ghost_ptrp r p = Mem.h_exists (ghost_pts_to_sl r p) val ghost_ptr_sel' (#a:Type0) (r: ghost_ref a) (p: perm) : selector' a (ghost_ptrp r p) let ghost_ptr_sel' #a r p = fun h -> id_elim_exists #a (ghost_pts_to_sl r p) h let ghost_ptr_sel_depends_only_on (#a:Type0) (r:ghost_ref a) (p: perm) (m0:Mem.hmem (ghost_ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (Mem.join m0 m1)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (Mem.join m0 m1)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> p: Steel.FractionalPermission.perm -> m0: Steel.Memory.hmem (Steel.Reference.ghost_ptrp r p) -> FStar.Pervasives.Lemma (ensures Steel.Reference.ghost_ptr_sel' r p m0 == Steel.Reference.ghost_ptr_sel' r p (Steel.Memory.core_mem m0))
FStar.Pervasives.Lemma
[ "lemma" ]
[]
[ "Steel.Reference.ghost_ref", "Steel.FractionalPermission.perm", "Steel.Memory.hmem", "Steel.Reference.ghost_ptrp", "Steel.Memory.elim_wi", "Steel.Reference.ghost_pts_to_sl", "Steel.Memory.core_mem", "Prims.unit", "Steel.Reference.ghost_pts_to_witinv", "FStar.Ghost.reveal", "Steel.Memory.id_elim_exists", "Prims.l_True", "Prims.squash", "Prims.eq2", "Steel.Reference.ghost_ptr_sel'", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
true
false
true
false
false
let ghost_ptr_sel_depends_only_on_core (#a: Type0) (r: ghost_ref a) (p: perm) (m0: Mem.hmem (ghost_ptrp r p)) : Lemma (ghost_ptr_sel' r p m0 == ghost_ptr_sel' r p (core_mem m0)) =
let x = reveal (id_elim_exists #a (ghost_pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (ghost_pts_to_sl r p) (core_mem m0)) in ghost_pts_to_witinv r p; elim_wi (ghost_pts_to_sl r p) x y (core_mem m0)
false
Spec.Agile.HKDF.fst
Spec.Agile.HKDF.expand_loop
val expand_loop: a:fixed_len_alg -> prk:bytes -> info:bytes -> n:nat -> i:nat{i < n} -> a_spec a i -> Pure (a_spec a (i + 1) & Seq.lseq uint8 (hash_length a)) (requires hash_length a <= Seq.length prk /\ HMAC.keysized a (Seq.length prk) /\ (hash_length a + Seq.length info + 1 + block_length a) `less_than_max_input_length` a /\ n <= 255) (ensures fun _ -> True)
val expand_loop: a:fixed_len_alg -> prk:bytes -> info:bytes -> n:nat -> i:nat{i < n} -> a_spec a i -> Pure (a_spec a (i + 1) & Seq.lseq uint8 (hash_length a)) (requires hash_length a <= Seq.length prk /\ HMAC.keysized a (Seq.length prk) /\ (hash_length a + Seq.length info + 1 + block_length a) `less_than_max_input_length` a /\ n <= 255) (ensures fun _ -> True)
let expand_loop a prk info n i tag = let t = Spec.Agile.HMAC.hmac a prk (tag @| info @| Seq.create 1 (u8 (i + 1))) in t, t
{ "file_name": "specs/Spec.Agile.HKDF.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 6, "end_line": 57, "start_col": 0, "start_line": 55 }
module Spec.Agile.HKDF open FStar.Integers open Spec.Hash.Definitions /// FUNCTIONAL SPECIFICATION: /// /// * extraction is just HMAC using the salt as key and the input /// keying materials as text. /// /// * expansion does its own formatting of input key materials. open FStar.Seq #set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 50" let extract = Spec.Agile.HMAC.hmac module Seq = Lib.Sequence open Lib.IntTypes /// HKDF-Expand(PRK, info, L) /// /// N = ceil(L/HashLen) /// T = T(1) | T(2) | T(3) | ... | T(N) /// OKM = first L octets of T /// /// where: /// T(0) = empty string (zero length) /// T(1) = HMAC-Hash(PRK, T(0) | info | 0x01) /// T(2) = HMAC-Hash(PRK, T(1) | info | 0x02) /// T(3) = HMAC-Hash(PRK, T(2) | info | 0x03) /// /// See https://tools.ietf.org/html/rfc5869#section-2.3 /// The type of T(i) is [a_spec a i] let a_spec (a:fixed_len_alg) (i:nat) = Seq.lseq uint8 (if i = 0 then 0 else hash_length a) /// The main loop that computes T(i) val expand_loop: a:fixed_len_alg -> prk:bytes -> info:bytes -> n:nat -> i:nat{i < n} -> a_spec a i -> Pure (a_spec a (i + 1) & Seq.lseq uint8 (hash_length a)) (requires hash_length a <= Seq.length prk /\ HMAC.keysized a (Seq.length prk) /\ (hash_length a + Seq.length info + 1 + block_length a) `less_than_max_input_length` a /\ n <= 255)
{ "checked_file": "/", "dependencies": [ "Spec.Hash.Definitions.fst.checked", "Spec.Agile.HMAC.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Integers.fst.checked" ], "interface_file": true, "source_file": "Spec.Agile.HKDF.fst" }
[ { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "Seq" }, { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Integers", "short_module": null }, { "abbrev": false, "full_module": "Spec.Hash.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "Spec.Agile", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
a: Spec.Hash.Definitions.fixed_len_alg -> prk: Spec.Hash.Definitions.bytes -> info: Spec.Hash.Definitions.bytes -> n: FStar.Integers.nat -> i: FStar.Integers.nat{i < n} -> tag: Spec.Agile.HKDF.a_spec a i -> Prims.Pure (Spec.Agile.HKDF.a_spec a (i + 1) * Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length a))
Prims.Pure
[]
[]
[ "Spec.Hash.Definitions.fixed_len_alg", "Spec.Hash.Definitions.bytes", "FStar.Integers.nat", "Prims.b2t", "FStar.Integers.op_Less", "FStar.Integers.Signed", "FStar.Integers.Winfinite", "Spec.Agile.HKDF.a_spec", "FStar.Pervasives.Native.Mktuple2", "FStar.Integers.op_Plus", "Lib.Sequence.lseq", "Lib.IntTypes.uint8", "Spec.Hash.Definitions.hash_length", "Spec.Agile.HMAC.lbytes", "Spec.Agile.HMAC.hmac", "FStar.Seq.Base.op_At_Bar", "Lib.Sequence.create", "Lib.IntTypes.u8", "FStar.Pervasives.Native.tuple2" ]
[]
false
false
false
false
false
let expand_loop a prk info n i tag =
let t = Spec.Agile.HMAC.hmac a prk (tag @| info @| Seq.create 1 (u8 (i + 1))) in t, t
false
Hacl.Bignum.Addition.fst
Hacl.Bignum.Addition.bn_sub_eq_len_u
val bn_sub_eq_len_u (#t: limb_t) (aLen: size_t) : bn_sub_eq_len_st t aLen
val bn_sub_eq_len_u (#t: limb_t) (aLen: size_t) : bn_sub_eq_len_st t aLen
let bn_sub_eq_len_u (#t:limb_t) (aLen:size_t) : bn_sub_eq_len_st t aLen = match t with | U32 -> bn_sub_eq_len_u32 aLen | U64 -> bn_sub_eq_len_u64 aLen
{ "file_name": "code/bignum/Hacl.Bignum.Addition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 33, "end_line": 111, "start_col": 0, "start_line": 108 }
module Hacl.Bignum.Addition open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Hacl.Bignum.Definitions open Hacl.Bignum.Base open Hacl.Impl.Lib open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module B = LowStar.Buffer module S = Hacl.Spec.Bignum.Addition module LSeq = Lib.Sequence module SL = Hacl.Spec.Lib #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val bn_sub_carry: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> c_in:carry t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub_carry (as_seq h0 a) c_in in c_out == c /\ as_seq h1 res == r)) let bn_sub_carry #t aLen a c_in res = push_frame (); let c = create 1ul c_in in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_carry_f (as_seq h a) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 (uint #t 0) res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1 ); let res = c.(0ul) in pop_frame (); res inline_for_extraction noextract let bn_sub_eq_len_st (t:limb_t) (aLen:size_t) = a:lbignum t aLen -> b:lbignum t aLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ eq_or_disjoint a b /\ eq_or_disjoint a res /\ eq_or_disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = SL.generate_elems (v aLen) (v aLen) (S.bn_sub_f (as_seq h0 a) (as_seq h0 b)) (uint #t 0) in c_out == c /\ as_seq h1 res == r)) inline_for_extraction noextract val bn_sub_eq_len: #t:limb_t -> aLen:size_t -> bn_sub_eq_len_st t aLen let bn_sub_eq_len #t aLen a b res = push_frame (); let c = create 1ul (uint #t 0) in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_f (as_seq h a) (as_seq h b) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let t2 = b.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 t2 res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1; lemma_eq_disjoint aLen aLen 1ul res b c i h0 h1 ); let res = c.(0ul) in pop_frame (); res let bn_sub_eq_len_u32 (aLen:size_t) : bn_sub_eq_len_st U32 aLen = bn_sub_eq_len aLen let bn_sub_eq_len_u64 (aLen:size_t) : bn_sub_eq_len_st U64 aLen = bn_sub_eq_len aLen
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Lib.fst.checked", "Hacl.Spec.Bignum.Addition.fst.checked", "Hacl.Impl.Lib.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Addition.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Lib", "short_module": "SL" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Addition", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Lib", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
aLen: Lib.IntTypes.size_t -> Hacl.Bignum.Addition.bn_sub_eq_len_st t aLen
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Lib.IntTypes.size_t", "Hacl.Bignum.Addition.bn_sub_eq_len_u32", "Hacl.Bignum.Addition.bn_sub_eq_len_u64", "Hacl.Bignum.Addition.bn_sub_eq_len_st" ]
[]
false
false
false
false
false
let bn_sub_eq_len_u (#t: limb_t) (aLen: size_t) : bn_sub_eq_len_st t aLen =
match t with | U32 -> bn_sub_eq_len_u32 aLen | U64 -> bn_sub_eq_len_u64 aLen
false
Steel.Reference.fst
Steel.Reference.ghost_pts_to_perm
val ghost_pts_to_perm (#a: _) (#u: _) (#p: _) (#v: _) (r: ghost_ref a) : SteelGhost unit u (ghost_pts_to r p v) (fun _ -> ghost_pts_to r p v) (fun _ -> True) (fun _ _ _ -> p `lesser_equal_perm` full_perm)
val ghost_pts_to_perm (#a: _) (#u: _) (#p: _) (#v: _) (r: ghost_ref a) : SteelGhost unit u (ghost_pts_to r p v) (fun _ -> ghost_pts_to r p v) (fun _ -> True) (fun _ _ _ -> p `lesser_equal_perm` full_perm)
let ghost_pts_to_perm r = H.ghost_pts_to_perm r
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 47, "end_line": 432, "start_col": 0, "start_line": 432 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x) let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) [@@__reduce__] let raise_erased (#a:Type0) (x:erased a) : erased (U.raise_t u#0 u#1 a) = Ghost.hide (U.raise_val (Ghost.reveal x)) let ghost_alloc_pt (#a:Type) (#u:_) (x:erased a) : SteelGhostT (ghost_ref a) u emp (fun r -> ghost_pts_to r full_perm x) = H.ghost_alloc (raise_erased x) let ghost_free_pt r = H.ghost_free r let ghost_share_gen_pt #_ #_ #_ #x r p1 p2 = H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2 let ghost_share_pt (#a:Type) (#u:_) (#p:perm) (#x:erased a) (r:ghost_ref a) = H.ghost_share #_ #_ #_ #(raise_erased x) r let ghost_gather_pt (#a:Type) (#u:_) (#p0 #p1:perm) (#x0 #x1:erased a) (r:ghost_ref a) : SteelGhost unit u (ghost_pts_to r p0 x0 `star` ghost_pts_to r p1 x1) (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0) (requires fun _ -> true) (ensures fun _ _ _ -> x0 == x1) = H.ghost_gather r let ghost_pts_to_injective_eq (#a:_) (#u:_) (#p #q:_) (r:ghost_ref a) (v0 v1:Ghost.erased a) : SteelGhost unit u (ghost_pts_to r p v0 `star` ghost_pts_to r q v1) (fun _ -> ghost_pts_to r p v0 `star` ghost_pts_to r q v0) (requires fun _ -> True) (ensures fun _ _ _ -> v0 == v1) = H.ghost_pts_to_injective_eq #_ #_ #p #q r (raise_erased v0) (raise_erased v1)
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> Steel.Effect.Atomic.SteelGhost Prims.unit
Steel.Effect.Atomic.SteelGhost
[]
[]
[ "Steel.Memory.inames", "Steel.FractionalPermission.perm", "Steel.Reference.ghost_ref", "Steel.HigherReference.ghost_pts_to_perm", "FStar.Universe.raise_t", "FStar.Universe.raise_val", "Prims.unit" ]
[]
false
true
false
false
false
let ghost_pts_to_perm r =
H.ghost_pts_to_perm r
false
Steel.Reference.fst
Steel.Reference.ghost_share_pt
val ghost_share_pt (#a:Type) (#u:_) (#p:perm) (#x:erased a) (r:ghost_ref a) : SteelGhostT unit u (ghost_pts_to r p x) (fun _ -> ghost_pts_to r (half_perm p) x `star` ghost_pts_to r (half_perm p) x)
val ghost_share_pt (#a:Type) (#u:_) (#p:perm) (#x:erased a) (r:ghost_ref a) : SteelGhostT unit u (ghost_pts_to r p x) (fun _ -> ghost_pts_to r (half_perm p) x `star` ghost_pts_to r (half_perm p) x)
let ghost_share_pt (#a:Type) (#u:_) (#p:perm) (#x:erased a) (r:ghost_ref a) = H.ghost_share #_ #_ #_ #(raise_erased x) r
{ "file_name": "lib/steel/Steel.Reference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
{ "end_col": 47, "end_line": 410, "start_col": 0, "start_line": 406 }
(* Copyright 2020 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 Steel.Reference open FStar.Ghost open Steel.Memory open Steel.Effect.Atomic open Steel.Effect module Mem = Steel.Memory module H = Steel.HigherReference module U = FStar.Universe #set-options "--ide_id_info_off" let ref a = H.ref (U.raise_t a) let null #a = H.null #(U.raise_t a) let is_null #a r = H.is_null #(U.raise_t a) r let pts_to_sl r p v = H.pts_to_sl r p (U.raise_val v) val raise_val_inj (#a:Type) (x y:a) : Lemma (requires U.raise_val x == U.raise_val y) (ensures x == y) let raise_val_inj x y = U.downgrade_val_raise_val x; U.downgrade_val_raise_val y let pts_to_ref_injective (#a: Type u#0) (r: ref a) (p0 p1:perm) (v0 v1:a) (m:mem) : Lemma (requires interp (pts_to_sl r p0 v0 `Mem.star` pts_to_sl r p1 v1) m) (ensures v0 == v1) = let v0' = U.raise_val v0 in let v1' = U.raise_val v1 in H.pts_to_ref_injective r p0 p1 v0' v1' m; raise_val_inj v0 v1 let pts_to_not_null (#a:Type u#0) (x:ref a) (p:perm) (v:a) (m:mem) : Lemma (requires interp (pts_to_sl x p v) m) (ensures x =!= null) = let v = U.raise_val v in H.pts_to_not_null #(U.raise_t a) x p v m // let pts_to_not_null' (#a:Type u#0) // (x:ref a) // (p:perm) // (v: erased a) // (m:mem) // (m1:mem{disjoint m m1}) // : Lemma (requires interp (pts_to_sl x p v) m) // (ensures interp (pts_to_sl x p v) (Mem.join m m1)) // = () let pts_to_witinv (#a:Type) (r:ref a) (p:perm) : Lemma (is_witness_invariant (pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (pts_to_sl r p x) m /\ interp (pts_to_sl r p y) m)) (ensures (x == y)) = H.pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) let pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r = extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1) (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m); rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ()) let pts_to_perm r = H.pts_to_perm r let alloc_pt x = let r = H.alloc (U.raise_val x) in rewrite_slprop (H.pts_to r full_perm (U.raise_val x)) (pts_to r full_perm x) (fun _ -> ()); return r let read_pt #a #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.read r in let v':a = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let read_refine_pt #a #p q r = Classical.forall_intro_2 reveal_equiv; lift_exists (fun (v:a) -> pts_to r p v `star` q v); exists_cong (fun (v:U.raise_t a) -> pts_to r p (U.downgrade_val v) `star` q (U.downgrade_val v)) (fun (v:U.raise_t a) -> H.pts_to r p v `star` U.lift_dom q v); let x = H.read_refine (U.lift_dom q) r in rewrite_slprop (H.pts_to r p (hide x) `star` U.lift_dom q x) (pts_to r p (U.downgrade_val x) `star` q (U.downgrade_val x)) (fun _ -> ()); return (U.downgrade_val x) let write_pt #a #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let free_pt #a #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); H.free r let share_gen_pt #a #uses #p #v r p1 p2 = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share_gen r p1 p2; rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ()); rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ()) let share_pt #a #uses #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); H.share r; rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()); rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ()) let hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a) : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1) [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))] = let u0 = hide (U.raise_val (reveal v0)) in let u1 = hide (U.raise_val (reveal v1)) in assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==> v0 == v1) let gather_pt #a #uses #p0 #p1 #v0 #v1 r = let v0' = Ghost.hide (U.raise_val (Ghost.reveal v0)) in let v1' = Ghost.hide (U.raise_val (Ghost.reveal v1)) in rewrite_slprop (pts_to r p0 v0) (H.pts_to r p0 v0') (fun _ -> ()); rewrite_slprop (pts_to r p1 v1) (H.pts_to r p1 v1') (fun _ -> ()); let (u:unit{v0' == v1'}) = H.gather #_ #_ #p0 #p1 #v0' #v1' r in rewrite_slprop (H.pts_to r (sum_perm p0 p1) v0') (pts_to r (sum_perm p0 p1) v0) (fun _ -> ()); u let raise_equiv (#t:Type) (x y:t) : Lemma (U.raise_val x == U.raise_val y <==> x == y) = assert (U.downgrade_val (U.raise_val x) == x); assert (U.downgrade_val (U.raise_val y) == y) let downgrade_equiv (#t:Type) (x y:U.raise_t t) : Lemma (U.downgrade_val x == U.downgrade_val y <==> x == y) = assert (U.raise_val (U.downgrade_val x) == x); assert (U.raise_val (U.downgrade_val y) == y) let lift_eq (#t:eqtype) (x y:U.raise_t t) : b:bool{b <==> x==y} = downgrade_equiv x y; U.downgrade_val x = U.downgrade_val y let cas_action (#t:eqtype) (#uses:inames) (r:ref t) (v:Ghost.erased t) (v_old:t) (v_new:t) (frame:slprop) : MstTot (b:bool{b <==> (Ghost.reveal v == v_old)}) uses (pts_to_sl r full_perm v) (fun b -> if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v) frame (fun _ -> True) (fun _ _ _ -> True) = let hv = (Ghost.hide (U.raise_val (Ghost.reveal v))) in let b = H.cas_action #(U.raise_t t) (lift_eq #t) #uses r hv (U.raise_val v_old) (U.raise_val v_new) frame in assert (b <==> (Ghost.reveal hv == U.raise_val v_old)); assert (b <==> U.raise_val (Ghost.reveal v) == U.raise_val v_old); raise_equiv (Ghost.reveal v) v_old; b let atomic_read_pt_u32 #_ #p #v r = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ()); let x = H.atomic_read r in let v':U32.t = U.downgrade_val x in rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ()); return v' let atomic_write_pt_u32 #_ #v r x = let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ()); let x' = U.raise_val x in H.atomic_write r x'; rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ()) let cas_pt_u32 #uses r v v_old v_new = let b = as_atomic_action (cas_action #U32.t #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b let cas_pt_bool #uses r v v_old v_new = let b = as_atomic_action (cas_action #bool #uses r v v_old v_new) in rewrite_slprop (to_vprop (if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v)) (if b then pts_to r full_perm v_new else pts_to r full_perm v) (fun _ -> ()); return b (* Library for references with fractional permissions. Permissions need to be an index of the vprop ptr. It cannot be part of a selector, as it is not invariant when joining with a disjoint memory Using the value of the ref as a selector is ok because refs with fractional permissions all share the same value. Refs on PCM are more complicated, and likely not usable with selectors *) let ptrp r p = Mem.h_exists (pts_to_sl r p) val ptr_sel' (#a:Type0) (r: ref a) (p: perm) : selector' a (ptrp r p) let ptr_sel' #a r p = fun h -> id_elim_exists #a (pts_to_sl r p) h let ptr_sel_depends_only_on (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) (m1:mem{disjoint m0 m1}) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (Mem.join m0 m1)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (Mem.join m0 m1)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (Mem.join m0 m1) let ptr_sel_depends_only_on_core (#a:Type0) (r:ref a) (p: perm) (m0:Mem.hmem (ptrp r p)) : Lemma (ptr_sel' r p m0 == ptr_sel' r p (core_mem m0)) = let x = reveal (id_elim_exists #a (pts_to_sl r p) m0) in let y = reveal (id_elim_exists #a (pts_to_sl r p) (core_mem m0)) in pts_to_witinv r p; elim_wi (pts_to_sl r p) x y (core_mem m0) let ptrp_sel r p = Classical.forall_intro_2 (ptr_sel_depends_only_on r p); Classical.forall_intro (ptr_sel_depends_only_on_core r p); ptr_sel' r p let ptrp_sel_interp #a r p m = pts_to_witinv r p let intro_ptrp_interp r p v m = intro_h_exists (reveal v) (pts_to_sl r p) m let intro_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (pts_to_sl r p v) m) (ensures interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) = Mem.intro_h_exists (reveal v) (pts_to_sl r p) m; pts_to_witinv r p let elim_vptr_lemma (#a:Type) (r:ref a) (p: perm) (v:erased a) (m:mem) : Lemma (requires interp (ptrp r p) m /\ ptrp_sel r p m == reveal v) (ensures interp (pts_to_sl r p v) m) = Mem.elim_h_exists (pts_to_sl r p) m; pts_to_witinv r p let intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a) : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p) (requires fun _ -> True) (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v) = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v) let elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v) (requires fun _ -> True) (ensures fun h0 v _ -> reveal v == h0 (vptrp r p)) = let v = gget (vptrp r p) in change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v); v let malloc x = let r = alloc_pt x in intro_vptr r _ (hide x); return r let free r = let _ = elim_vptr r _ in free_pt r let readp r _ = let _ = elim_vptr r _ in let x = read_pt r in intro_vptr r _ x; return x let write r x = let _ = elim_vptr r _ in write_pt r x; intro_vptr r _ x let share #a #_ #p r = let x = elim_vptr r p in share_pt r; intro_vptr r _ x; intro_vptr r _ x let gather_gen #a #_ r p0 p1 = let x1 = elim_vptr r p1 in let x0 = elim_vptr r p0 in gather_pt #_ #_ #p0 #p1 #x0 #x1 r; intro_vptr r (sum_perm p0 p1) x0; sum_perm p0 p1 let gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a) : SteelGhost unit uses (vptrp r (half_perm p) `star` vptrp r (half_perm p)) (fun _ -> vptrp r p) (fun _ -> True) (fun h _ h' -> h' (vptrp r p) == h (vptrp r (half_perm p)) ) = let _ = gather_gen r _ _ in change_equal_slprop (vptrp r _) (vptrp r p) (*** Lemmas on references *) let vptrp_not_null #opened #a r p = change_slprop_rel (vptrp r p) (vptrp r p) (fun x y -> x == y /\ is_null r == false) (fun m -> pts_to_not_null r p (ptrp_sel r p m) m) (*** Ghost pointers *) (*** GHOST REFERENCES ***) let ghost_ref a = H.ghost_ref (U.raise_t a) let dummy_ghost_ref a = H.reveal_ghost_ref (U.raise_t a); coerce_eq () (Ghost.hide (H.null #(U.raise_t a))) [@__reduce__] let ghost_pts_to_sl #a r p x = H.ghost_pts_to_sl #(U.raise_t a) r p (U.raise_val x) let ghost_pts_to_witinv (#a:Type) (r:ghost_ref a) (p:perm) : Lemma (is_witness_invariant (ghost_pts_to_sl r p)) = let aux (x y : a) (m:mem) : Lemma (requires (interp (ghost_pts_to_sl r p x) m /\ interp (ghost_pts_to_sl r p y) m)) (ensures (x == y)) = H.ghost_pts_to_witinv r p; raise_val_inj x y in Classical.forall_intro_3 (fun x y -> Classical.move_requires (aux x y)) [@@__reduce__] let raise_erased (#a:Type0) (x:erased a) : erased (U.raise_t u#0 u#1 a) = Ghost.hide (U.raise_val (Ghost.reveal x)) let ghost_alloc_pt (#a:Type) (#u:_) (x:erased a) : SteelGhostT (ghost_ref a) u emp (fun r -> ghost_pts_to r full_perm x) = H.ghost_alloc (raise_erased x) let ghost_free_pt r = H.ghost_free r let ghost_share_gen_pt #_ #_ #_ #x r p1 p2 = H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2
{ "checked_file": "/", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.HigherReference.fsti.checked", "Steel.Effect.Atomic.fsti.checked", "Steel.Effect.fsti.checked", "prims.fst.checked", "FStar.Universe.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.fsti.checked" ], "interface_file": true, "source_file": "Steel.Reference.fst" }
[ { "abbrev": true, "full_module": "FStar.Universe", "short_module": "U" }, { "abbrev": true, "full_module": "Steel.HigherReference", "short_module": "H" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Atomic", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.FractionalPermission", "short_module": null }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "Steel", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "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
r: Steel.Reference.ghost_ref a -> Steel.Effect.Atomic.SteelGhostT Prims.unit
Steel.Effect.Atomic.SteelGhostT
[]
[]
[ "Steel.Memory.inames", "Steel.FractionalPermission.perm", "FStar.Ghost.erased", "Steel.Reference.ghost_ref", "Steel.HigherReference.ghost_share", "FStar.Universe.raise_t", "Steel.Reference.raise_erased", "Prims.unit" ]
[]
false
true
false
false
false
let ghost_share_pt (#a: Type) (#u: _) (#p: perm) (#x: erased a) (r: ghost_ref a) =
H.ghost_share #_ #_ #_ #(raise_erased x) r
false
Hacl.Bignum.Addition.fst
Hacl.Bignum.Addition.bn_add_eq_len_st
val bn_add_eq_len_st : t: Hacl.Bignum.Definitions.limb_t -> aLen: Lib.IntTypes.size_t -> Type0
let bn_add_eq_len_st (t:limb_t) (aLen:size_t) = a:lbignum t aLen -> b:lbignum t aLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ eq_or_disjoint a b /\ eq_or_disjoint a res /\ eq_or_disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = SL.generate_elems (v aLen) (v aLen) (S.bn_add_f (as_seq h0 a) (as_seq h0 b)) (uint #t 0) in c_out == c /\ as_seq h1 res == r))
{ "file_name": "code/bignum/Hacl.Bignum.Addition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 38, "end_line": 228, "start_col": 0, "start_line": 218 }
module Hacl.Bignum.Addition open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Hacl.Bignum.Definitions open Hacl.Bignum.Base open Hacl.Impl.Lib open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module B = LowStar.Buffer module S = Hacl.Spec.Bignum.Addition module LSeq = Lib.Sequence module SL = Hacl.Spec.Lib #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val bn_sub_carry: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> c_in:carry t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub_carry (as_seq h0 a) c_in in c_out == c /\ as_seq h1 res == r)) let bn_sub_carry #t aLen a c_in res = push_frame (); let c = create 1ul c_in in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_carry_f (as_seq h a) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 (uint #t 0) res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1 ); let res = c.(0ul) in pop_frame (); res inline_for_extraction noextract let bn_sub_eq_len_st (t:limb_t) (aLen:size_t) = a:lbignum t aLen -> b:lbignum t aLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ eq_or_disjoint a b /\ eq_or_disjoint a res /\ eq_or_disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = SL.generate_elems (v aLen) (v aLen) (S.bn_sub_f (as_seq h0 a) (as_seq h0 b)) (uint #t 0) in c_out == c /\ as_seq h1 res == r)) inline_for_extraction noextract val bn_sub_eq_len: #t:limb_t -> aLen:size_t -> bn_sub_eq_len_st t aLen let bn_sub_eq_len #t aLen a b res = push_frame (); let c = create 1ul (uint #t 0) in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_f (as_seq h a) (as_seq h b) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let t2 = b.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 t2 res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1; lemma_eq_disjoint aLen aLen 1ul res b c i h0 h1 ); let res = c.(0ul) in pop_frame (); res let bn_sub_eq_len_u32 (aLen:size_t) : bn_sub_eq_len_st U32 aLen = bn_sub_eq_len aLen let bn_sub_eq_len_u64 (aLen:size_t) : bn_sub_eq_len_st U64 aLen = bn_sub_eq_len aLen inline_for_extraction noextract let bn_sub_eq_len_u (#t:limb_t) (aLen:size_t) : bn_sub_eq_len_st t aLen = match t with | U32 -> bn_sub_eq_len_u32 aLen | U64 -> bn_sub_eq_len_u64 aLen inline_for_extraction noextract val bn_sub: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> bLen:size_t{v bLen <= v aLen} -> b:lbignum t bLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ disjoint a b /\ eq_or_disjoint a res /\ disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub (as_seq h0 a) (as_seq h0 b) in c_out == c /\ as_seq h1 res == r)) let bn_sub #t aLen a bLen b res = let h0 = ST.get () in let a0 = sub a 0ul bLen in let res0 = sub res 0ul bLen in let h1 = ST.get () in let c0 = bn_sub_eq_len bLen a0 b res0 in let h1 = ST.get () in if bLen <. aLen then begin [@inline_let] let rLen = aLen -! bLen in let a1 = sub a bLen rLen in let res1 = sub res bLen rLen in let c1 = bn_sub_carry rLen a1 c0 res1 in let h2 = ST.get () in LSeq.lemma_concat2 (v bLen) (as_seq h1 res0) (v rLen) (as_seq h2 res1) (as_seq h2 res); c1 end else c0 inline_for_extraction noextract val bn_sub1: #t:limb_t -> aLen:size_t{0 < v aLen} -> a:lbignum t aLen -> b1:limb t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub1 (as_seq h0 a) b1 in c_out == c /\ as_seq h1 res == r)) let bn_sub1 #t aLen a b1 res = let c0 = subborrow_st (uint #t 0) a.(0ul) b1 (sub res 0ul 1ul) in let h0 = ST.get () in LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 1) (LSeq.create 1 (LSeq.index (as_seq h0 res) 0)); if 1ul <. aLen then begin [@inline_let] let rLen = aLen -! 1ul in let a1 = sub a 1ul rLen in let res1 = sub res 1ul rLen in let c1 = bn_sub_carry rLen a1 c0 res1 in let h = ST.get () in LSeq.lemma_concat2 1 (LSeq.sub (as_seq h0 res) 0 1) (v rLen) (as_seq h res1) (as_seq h res); c1 end else c0 inline_for_extraction noextract val bn_add_carry: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> c_in:carry t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_add_carry (as_seq h0 a) c_in in c_out == c /\ as_seq h1 res == r)) let bn_add_carry #t aLen a c_in res = push_frame (); let c = create 1ul c_in in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_add_carry_f (as_seq h a) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let res_i = sub res i 1ul in c.(0ul) <- addcarry_st c.(0ul) t1 (uint #t 0) res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1 ); let res = c.(0ul) in pop_frame (); res
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Lib.fst.checked", "Hacl.Spec.Bignum.Addition.fst.checked", "Hacl.Impl.Lib.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Addition.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Lib", "short_module": "SL" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Addition", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Lib", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
t: Hacl.Bignum.Definitions.limb_t -> aLen: Lib.IntTypes.size_t -> Type0
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Lib.IntTypes.size_t", "Hacl.Bignum.Definitions.lbignum", "Hacl.Spec.Bignum.Base.carry", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "Lib.Buffer.live", "Lib.Buffer.MUT", "Hacl.Bignum.Definitions.limb", "Lib.Buffer.eq_or_disjoint", "Lib.Buffer.modifies", "Lib.Buffer.loc", "Lib.Sequence.seq", "Hacl.Spec.Bignum.Definitions.limb", "Prims.eq2", "Prims.nat", "Lib.Sequence.length", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.l_or", "FStar.Seq.Base.length", "Lib.Buffer.as_seq", "Prims.logical", "FStar.Pervasives.Native.tuple2", "Hacl.Spec.Lib.generate_elems", "Hacl.Spec.Bignum.Addition.bn_add_f", "Lib.IntTypes.uint", "Lib.IntTypes.SEC" ]
[]
false
false
false
true
true
let bn_add_eq_len_st (t: limb_t) (aLen: size_t) =
a: lbignum t aLen -> b: lbignum t aLen -> res: lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ eq_or_disjoint a b /\ eq_or_disjoint a res /\ eq_or_disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = SL.generate_elems (v aLen) (v aLen) (S.bn_add_f (as_seq h0 a) (as_seq h0 b)) (uint #t 0) in c_out == c /\ as_seq h1 res == r))
false
Hacl.Bignum.Addition.fst
Hacl.Bignum.Addition.bn_add_eq_len_u
val bn_add_eq_len_u (#t: limb_t) (aLen: size_t) : bn_add_eq_len_st t aLen
val bn_add_eq_len_u (#t: limb_t) (aLen: size_t) : bn_add_eq_len_st t aLen
let bn_add_eq_len_u (#t:limb_t) (aLen:size_t) : bn_add_eq_len_st t aLen = match t with | U32 -> bn_add_eq_len_u32 aLen | U64 -> bn_add_eq_len_u64 aLen
{ "file_name": "code/bignum/Hacl.Bignum.Addition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git", "project_name": "hacl-star" }
{ "end_col": 33, "end_line": 268, "start_col": 0, "start_line": 265 }
module Hacl.Bignum.Addition open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open Hacl.Bignum.Definitions open Hacl.Bignum.Base open Hacl.Impl.Lib open Lib.IntTypes open Lib.Buffer module ST = FStar.HyperStack.ST module B = LowStar.Buffer module S = Hacl.Spec.Bignum.Addition module LSeq = Lib.Sequence module SL = Hacl.Spec.Lib #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" inline_for_extraction noextract val bn_sub_carry: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> c_in:carry t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub_carry (as_seq h0 a) c_in in c_out == c /\ as_seq h1 res == r)) let bn_sub_carry #t aLen a c_in res = push_frame (); let c = create 1ul c_in in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_carry_f (as_seq h a) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 (uint #t 0) res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1 ); let res = c.(0ul) in pop_frame (); res inline_for_extraction noextract let bn_sub_eq_len_st (t:limb_t) (aLen:size_t) = a:lbignum t aLen -> b:lbignum t aLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ eq_or_disjoint a b /\ eq_or_disjoint a res /\ eq_or_disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = SL.generate_elems (v aLen) (v aLen) (S.bn_sub_f (as_seq h0 a) (as_seq h0 b)) (uint #t 0) in c_out == c /\ as_seq h1 res == r)) inline_for_extraction noextract val bn_sub_eq_len: #t:limb_t -> aLen:size_t -> bn_sub_eq_len_st t aLen let bn_sub_eq_len #t aLen a b res = push_frame (); let c = create 1ul (uint #t 0) in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_sub_f (as_seq h a) (as_seq h b) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let t2 = b.(i) in let res_i = sub res i 1ul in c.(0ul) <- subborrow_st c.(0ul) t1 t2 res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1; lemma_eq_disjoint aLen aLen 1ul res b c i h0 h1 ); let res = c.(0ul) in pop_frame (); res let bn_sub_eq_len_u32 (aLen:size_t) : bn_sub_eq_len_st U32 aLen = bn_sub_eq_len aLen let bn_sub_eq_len_u64 (aLen:size_t) : bn_sub_eq_len_st U64 aLen = bn_sub_eq_len aLen inline_for_extraction noextract let bn_sub_eq_len_u (#t:limb_t) (aLen:size_t) : bn_sub_eq_len_st t aLen = match t with | U32 -> bn_sub_eq_len_u32 aLen | U64 -> bn_sub_eq_len_u64 aLen inline_for_extraction noextract val bn_sub: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> bLen:size_t{v bLen <= v aLen} -> b:lbignum t bLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ disjoint a b /\ eq_or_disjoint a res /\ disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub (as_seq h0 a) (as_seq h0 b) in c_out == c /\ as_seq h1 res == r)) let bn_sub #t aLen a bLen b res = let h0 = ST.get () in let a0 = sub a 0ul bLen in let res0 = sub res 0ul bLen in let h1 = ST.get () in let c0 = bn_sub_eq_len bLen a0 b res0 in let h1 = ST.get () in if bLen <. aLen then begin [@inline_let] let rLen = aLen -! bLen in let a1 = sub a bLen rLen in let res1 = sub res bLen rLen in let c1 = bn_sub_carry rLen a1 c0 res1 in let h2 = ST.get () in LSeq.lemma_concat2 (v bLen) (as_seq h1 res0) (v rLen) (as_seq h2 res1) (as_seq h2 res); c1 end else c0 inline_for_extraction noextract val bn_sub1: #t:limb_t -> aLen:size_t{0 < v aLen} -> a:lbignum t aLen -> b1:limb t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_sub1 (as_seq h0 a) b1 in c_out == c /\ as_seq h1 res == r)) let bn_sub1 #t aLen a b1 res = let c0 = subborrow_st (uint #t 0) a.(0ul) b1 (sub res 0ul 1ul) in let h0 = ST.get () in LSeq.eq_intro (LSeq.sub (as_seq h0 res) 0 1) (LSeq.create 1 (LSeq.index (as_seq h0 res) 0)); if 1ul <. aLen then begin [@inline_let] let rLen = aLen -! 1ul in let a1 = sub a 1ul rLen in let res1 = sub res 1ul rLen in let c1 = bn_sub_carry rLen a1 c0 res1 in let h = ST.get () in LSeq.lemma_concat2 1 (LSeq.sub (as_seq h0 res) 0 1) (v rLen) (as_seq h res1) (as_seq h res); c1 end else c0 inline_for_extraction noextract val bn_add_carry: #t:limb_t -> aLen:size_t -> a:lbignum t aLen -> c_in:carry t -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h res /\ eq_or_disjoint a res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = S.bn_add_carry (as_seq h0 a) c_in in c_out == c /\ as_seq h1 res == r)) let bn_add_carry #t aLen a c_in res = push_frame (); let c = create 1ul c_in in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_add_carry_f (as_seq h a) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let res_i = sub res i 1ul in c.(0ul) <- addcarry_st c.(0ul) t1 (uint #t 0) res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1 ); let res = c.(0ul) in pop_frame (); res inline_for_extraction noextract let bn_add_eq_len_st (t:limb_t) (aLen:size_t) = a:lbignum t aLen -> b:lbignum t aLen -> res:lbignum t aLen -> Stack (carry t) (requires fun h -> live h a /\ live h b /\ live h res /\ eq_or_disjoint a b /\ eq_or_disjoint a res /\ eq_or_disjoint b res) (ensures fun h0 c_out h1 -> modifies (loc res) h0 h1 /\ (let c, r = SL.generate_elems (v aLen) (v aLen) (S.bn_add_f (as_seq h0 a) (as_seq h0 b)) (uint #t 0) in c_out == c /\ as_seq h1 res == r)) inline_for_extraction noextract val bn_add_eq_len: #t:limb_t -> aLen:size_t -> bn_add_eq_len_st t aLen let bn_add_eq_len #t aLen a b res = push_frame (); let c = create 1ul (uint #t 0) in [@inline_let] let refl h i = LSeq.index (as_seq h c) 0 in [@inline_let] let footprint (i:size_nat{i <= v aLen}) : GTot (l:B.loc{B.loc_disjoint l (loc res) /\ B.address_liveness_insensitive_locs `B.loc_includes` l}) = loc c in [@inline_let] let spec h = S.bn_add_f (as_seq h a) (as_seq h b) in let h0 = ST.get () in fill_elems4 h0 aLen res refl footprint spec (fun i -> let h1 = ST.get () in let t1 = a.(i) in let t2 = b.(i) in let res_i = sub res i 1ul in c.(0ul) <- addcarry_st c.(0ul) t1 t2 res_i; lemma_eq_disjoint aLen aLen 1ul res a c i h0 h1; lemma_eq_disjoint aLen aLen 1ul res b c i h0 h1 ); let res = c.(0ul) in pop_frame (); res let bn_add_eq_len_u32 (aLen:size_t) : bn_add_eq_len_st U32 aLen = bn_add_eq_len aLen let bn_add_eq_len_u64 (aLen:size_t) : bn_add_eq_len_st U64 aLen = bn_add_eq_len aLen
{ "checked_file": "/", "dependencies": [ "prims.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Spec.Lib.fst.checked", "Hacl.Spec.Bignum.Addition.fst.checked", "Hacl.Impl.Lib.fst.checked", "Hacl.Bignum.Definitions.fst.checked", "Hacl.Bignum.Base.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Bignum.Addition.fst" }
[ { "abbrev": true, "full_module": "Hacl.Spec.Lib", "short_module": "SL" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Addition", "short_module": "S" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Lib", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Base", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Bignum", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
false
aLen: Lib.IntTypes.size_t -> Hacl.Bignum.Addition.bn_add_eq_len_st t aLen
Prims.Tot
[ "total" ]
[]
[ "Hacl.Bignum.Definitions.limb_t", "Lib.IntTypes.size_t", "Hacl.Bignum.Addition.bn_add_eq_len_u32", "Hacl.Bignum.Addition.bn_add_eq_len_u64", "Hacl.Bignum.Addition.bn_add_eq_len_st" ]
[]
false
false
false
false
false
let bn_add_eq_len_u (#t: limb_t) (aLen: size_t) : bn_add_eq_len_st t aLen =
match t with | U32 -> bn_add_eq_len_u32 aLen | U64 -> bn_add_eq_len_u64 aLen
false