-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Total and Stateful code of the DH model * Updated comment * Updated key usage in DH example * Executable DH protocol run * Adapted DH example to folder structure change in the main branch * DH example trace and crypto predicates; DH security lemmas * DH example add trace printing to debug protocol run * DH example compute_message1_proof and decode_message1_proof * DH example compute_message2_proof and decode_message2_proof * DH example compute_message3_proof and decode_message3_proof * DH example add ifuel option to crypto preds * DH example compatibility with main branch restored * DH example finished stateful proofs * Make DH example compatible with current main branch and clean up * DH example: changed is_dh_shared_key definition to use `equivalent tr` * DH example renamed folder to iso_dh and used 'equivalent tr' function in key_secrecy_lemma * DH example added ISO reference * DH example: changed names of security properties and added README.md * DH example sanity check for trace invariants and proof refactoring * DH example feedback Théophile * DH example proof trace invariants for example trace with SMTPats * cleanup: tighten ISO-DH invariants to simplify proofs * DH example improved security properties and changed SMTPats for the stateful proof functions * DH example move all crypto functions to the total code; cleanup code * DH example feedback Théophile and code cleanup * Updated README to include the ISO-DH example * README changed path to ISO-DH example * DH example updated README * cleanup: rework some ISO-DH security proofs --------- Co-authored-by: Théophile Wallez <[email protected]>
- Loading branch information
Showing
14 changed files
with
1,314 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ "fstar_exe":"fstar.exe", | ||
"options":["--cache_dir", "cache", "--hint_dir", "hints", "--use_hints", "--record_hints"], | ||
"include_dirs":[ | ||
"../comparse/src", "src/core", "src/lib", "src/lib/comparse", "src/lib/event", "src/lib/state", "src/lib/utils", "examples/nsl_pk"] | ||
"../comparse/src", "src/core", "src/lib", "src/lib/comparse", "src/lib/event", "src/lib/state", "src/lib/utils", "examples/nsl_pk", "examples/iso_dh"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module DY.Example.DH.Debug.Proof | ||
|
||
open DY.Core | ||
open DY.Lib | ||
open DY.Example.DH.Protocol.Stateful | ||
open DY.Example.DH.Protocol.Stateful.Proof | ||
open DY.Example.DH.Debug | ||
|
||
/// This module proves that the debug function | ||
/// fulfills the trace invariants. | ||
/// | ||
/// The proof works automatically because each | ||
/// stateful proof as a SMTPat (`[SMTPat (trace_invariant tr); SMTPat (protocol_function)]`). | ||
/// Another way to do this proof is to basically | ||
/// duplicate the code from the debug function and | ||
/// call all the lemmas for the stateful code manually. | ||
|
||
#set-options "--fuel 0 --ifuel 0 --z3rlimit 10 --z3cliopt 'smt.qi.eager_threshold=100'" | ||
val debug_proof: | ||
tr:trace -> | ||
Lemma | ||
(requires | ||
trace_invariant tr | ||
) | ||
(ensures ( | ||
let (_, tr_out) = debug () tr in | ||
trace_invariant tr_out | ||
) | ||
) | ||
let debug_proof tr = () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
module DY.Example.DH.Debug | ||
|
||
open DY.Core | ||
open DY.Lib | ||
open DY.Example.DH.Protocol.Stateful | ||
|
||
|
||
let debug () : traceful (option unit) = | ||
let _ = IO.debug_print_string "************* Trace *************\n" in | ||
(*** Initialize protocol run ***) | ||
let alice = "alice" in | ||
let bob = "bob" in | ||
|
||
// Generate private key for Alice | ||
let* alice_global_session_priv_key_id = initialize_private_keys alice in | ||
generate_private_key alice alice_global_session_priv_key_id (Sign "DH.SigningKey");* | ||
|
||
// Generate private key for Bob | ||
let* bob_global_session_priv_key_id = initialize_private_keys bob in | ||
generate_private_key bob bob_global_session_priv_key_id (Sign "DH.SigningKey");* | ||
|
||
// Store Bob's public key in Alice's state | ||
// 1. Retrieve Bob's private key from his session | ||
// 2. Compute the public key from the private key | ||
// 3. Initialize Alice's session to store public keys | ||
// 4. Install Bob's public key in Alice's public key store | ||
let*? priv_key_bob = get_private_key bob bob_global_session_priv_key_id (Sign "DH.SigningKey") in | ||
let pub_key_bob = vk priv_key_bob in | ||
let* alice_global_session_pub_key_id = initialize_pki alice in | ||
install_public_key alice alice_global_session_pub_key_id (Verify "DH.SigningKey") bob pub_key_bob;* | ||
|
||
// Store Alice's public key in Bob's state | ||
let*? priv_key_alice = get_private_key alice alice_global_session_priv_key_id (Sign "DH.SigningKey") in | ||
let pub_key_alice = vk priv_key_alice in | ||
let* bob_global_session_pub_key_id = initialize_pki bob in | ||
install_public_key bob bob_global_session_pub_key_id (Verify "DH.SigningKey") alice pub_key_alice;* | ||
|
||
let alice_global_session_ids: dh_global_sess_ids = {pki=alice_global_session_pub_key_id; private_keys=alice_global_session_priv_key_id} in | ||
let bob_global_session_ids: dh_global_sess_ids = {pki=bob_global_session_pub_key_id; private_keys=bob_global_session_priv_key_id} in | ||
|
||
(*** Run the protocol ***) | ||
// Alice | ||
let* alice_session_id = prepare_msg1 alice bob in | ||
let*? msg1_id = send_msg1 alice alice_session_id in | ||
|
||
// Bob | ||
let*? bob_session_id = prepare_msg2 alice bob msg1_id in | ||
let*? msg2_id = send_msg2 bob_global_session_ids bob bob_session_id in | ||
|
||
// Alice | ||
prepare_msg3 alice_global_session_ids alice alice_session_id bob msg2_id;* | ||
let*? msg3_id = send_msg3 alice_global_session_ids alice bob alice_session_id in | ||
|
||
// Bob | ||
verify_msg3 bob_global_session_ids alice bob msg3_id bob_session_id;* | ||
|
||
let* tr = get_trace in | ||
let _ = IO.debug_print_string ( | ||
trace_to_string default_trace_to_string_printers tr | ||
) in | ||
|
||
return (Some ()) | ||
|
||
//Run ``debug ()`` when the module loads | ||
#push-options "--warn_error -272" | ||
let _ = debug () Nil | ||
#pop-options |
Oops, something went wrong.