From b1f313b116edd2b68ae291db1d57d9c4588ab041 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 22 Dec 2016 00:07:22 -0500 Subject: [PATCH] more diagram work --- docs/w.dot | 222 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 151 insertions(+), 71 deletions(-) diff --git a/docs/w.dot b/docs/w.dot index 8c7351d..1e85bb4 100644 --- a/docs/w.dot +++ b/docs/w.dot @@ -1,72 +1,134 @@ digraph { - W_S_nothing [label="know\nnothing"] - W_S_nothing -> W_S_know_nameplate [label="set_nameplate()"] - W_S_know_nameplate [label="know (just)\nnameplate"] + /* could shave a RTT by committing to the nameplate early, before + finishing the rest of the code input. While the user is still + typing/completing the code, we claim the nameplate, open the mailbox, + and retrieve the peer's PAKE message. Then as soon as the user + finishes entering the code, we build our own PAKE message, send PAKE, + compute the key, send VERSION. Starting from the Return, this saves + two round trips. OTOH it adds consequences to hitting Tab. */ - W_P_build_and_post_pake [label="build_pake()\nMM_send(pake)" shape="box"] - W_S_know_code [label="know code\n"] - W_P_compute_key [label="compute_key()" shape="box"] - W_P_post_version [label="MM_send(version)\nnotify_verifier()" shape="box"] - W_S_know_key [label="know_key\nunverified" color="orange"] - W_P_verify [label="verify(msg)" shape="box"] - W_P_accept_msg [label="deliver\ninbound\nmsg()" shape="box"] - W_S_verified_key [color="green"] - W_P_mood_scary [shape="box" label="mood(scary)"] - W_P_notify_failure [shape="box" label="notify_failure()" color="red"] - W_P_mood_happy [shape="box" label="mood(happy)"] - W_S_closed [label="closed"] - W_P_mood_lonely [shape="box" label="mood(lonely)"] - W_P_queue1 [shape="box" style="dotted" label="queue\noutbound msg"] - W_P_queue2 [shape="box" style="dotted" label="queue\noutbound msg"] - W_P_queue3 [shape="box" style="dotted" label="queue\noutbound msg"] - W_P_queue4 [shape="box" style="dotted" label="queue\noutbound msg"] - W_P_send [shape="box" label="MM_send(msg)"] - W_P_send_queued [shape="box" label="MM_send()\nany queued\nmessages"] + WM_start [label="Wormhole\nMachine" style="dotted"] + WM_start -> WM_S_nothing [style="invis"] - W_S_nothing -> W_P_build_and_post_pake [label="set_code()"] - W_S_nothing -> W_P_queue1 [label="API_send" style="dotted"] - W_P_queue1 -> W_S_nothing [style="dotted"] - W_S_know_nameplate -> W_P_got_pakeinfo [label="W_rx_pake"] - W_S_know_nameplate -> W_P_build_and_post_pake [label="set_code()"] - W_P_got_pakeinfo [shape="box" label="got wordlist"] - W_P_got_pakeinfo -> W_S_know_pake2 - W_S_know_pake2 [label="know their pake"] - W_S_know_pake2 -> W_P_compute_key [label="set_code()"] - W_S_know_pake2 -> W_P_queue4 [label="API_send" style="dotted"] - W_P_queue4 -> W_S_know_pake2 [style="dotted"] - W_P_build_and_post_pake -> W_S_know_code - W_S_know_code -> W_P_compute_key [label="W_rx_pake"] - W_S_know_code -> W_P_queue2 [label="API_send" style="dotted"] - W_P_queue2 -> W_S_know_code [style="dotted"] - W_P_compute_key -> W_P_post_version [label="pake ok"] - W_P_post_version -> W_S_know_key - W_P_compute_key -> W_P_mood_scary [label="pake bad"] - W_P_mood_scary -> W_P_notify_failure - W_P_notify_failure -> W_S_closed - W_S_know_key -> W_P_verify [label="W_rx_msg()"] /* version or phase */ - W_S_know_key -> W_P_mood_lonely [label="close"] /* more like impatient */ - W_S_know_key -> W_P_queue3 [label="API_send" style="dotted"] - W_P_queue3 -> W_S_know_key [style="dotted"] - W_P_verify -> W_P_accept_msg [label="verify good"] - W_P_accept_msg -> W_P_send_queued - W_P_send_queued -> W_S_verified_key - W_P_verify -> W_P_mood_scary [label="verify bad"] - W_S_verified_key -> W_P_verify [label="W_rx_msg()"] /* probably phase */ - W_S_verified_key -> W_P_mood_happy [label="close"] - W_P_mood_happy -> W_S_closed - W_S_verified_key -> W_P_send [label="API_send"] - W_P_send -> W_S_verified_key - W_S_know_code -> W_P_mood_lonely [label="close"] - W_P_mood_lonely -> W_S_closed + WM_S_nothing [label="know\nnothing"] + WM_S_nothing -> WM_P_queue1 [label="API_send" style="dotted"] + WM_P_queue1 [shape="box" style="dotted" label="queue\noutbound msg"] + WM_P_queue1 -> WM_S_nothing [style="dotted"] + WM_S_nothing -> WM_P_build_and_post_pake [label="WM_set_code()"] + WM_P_build_and_post_pake [label="NM_set_nameplate()\nbuild_pake()\nMM_send(pake)" shape="box"] + WM_P_build_and_post_pake -> WM_S_know_code + + WM_S_know_code [label="know code\n"] + WM_S_know_code -> WM_P_queue2 [label="API_send" style="dotted"] + WM_P_queue2 [shape="box" style="dotted" label="queue\noutbound msg"] + WM_P_queue2 -> WM_S_know_code [style="dotted"] + WM_S_know_code -> WM_P_compute_key [label="WM_rx_pake"] + WM_S_know_code -> WM_P_mood_lonely [label="close"] + + WM_P_compute_key [label="compute_key()" shape="box"] + WM_P_compute_key -> WM_P_post_version [label="pake ok"] + WM_P_compute_key -> WM_P_mood_scary [label="pake bad"] + + WM_P_mood_scary [shape="box" label="MM_close()\nmood=scary"] + WM_P_mood_scary -> WM_P_notify_failure + + WM_P_notify_failure [shape="box" label="notify_failure()" color="red"] + WM_P_notify_failure -> WM_S_closed + + WM_P_post_version [label="MM_send(version)\nnotify_verifier()" shape="box"] + WM_P_post_version -> WM_S_know_key + + WM_S_know_key [label="know_key\nunverified" color="orange"] + WM_S_know_key -> WM_P_queue3 [label="API_send" style="dotted"] + WM_P_queue3 [shape="box" style="dotted" label="queue\noutbound msg"] + WM_P_queue3 -> WM_S_know_key [style="dotted"] + WM_S_know_key -> WM_P_verify [label="WM_rx_msg()"] /* version or phase */ + WM_S_know_key -> WM_P_mood_lonely [label="close"] /* more like impatient */ + + WM_P_verify [label="verify(msg)" shape="box"] + WM_P_verify -> WM_P_accept_msg [label="verify good"] + WM_P_verify -> WM_P_mood_scary [label="verify bad"] + + WM_P_accept_msg [label="deliver\ninbound\nmsg()" shape="box"] + WM_P_accept_msg -> WM_P_send_queued + + WM_P_send_queued [shape="box" label="MM_send()\nany queued\nmessages"] + WM_P_send_queued -> WM_S_verified_key + + WM_S_verified_key [color="green"] + WM_S_verified_key -> WM_P_verify [label="WM_rx_msg()"] /* probably phase */ + WM_S_verified_key -> WM_P_mood_happy [label="close"] + WM_S_verified_key -> WM_P_send [label="API_send"] + + WM_P_mood_happy [shape="box" label="MM_close()\nmood=happy"] + WM_P_mood_happy -> WM_S_closed + + WM_P_mood_lonely [shape="box" label="MM_close()\nmood=lonely"] + WM_P_mood_lonely -> WM_S_closed + + WM_P_send [shape="box" label="MM_send(msg)"] + WM_P_send -> WM_S_verified_key + + WM_S_closed [label="closed"] + + + WCM_start [label="Wormhole Code\nMachine" style="dotted"] + WCM_start -> WCM_S_unknown [style="invis"] + WCM_S_unknown [label="unknown"] + WCM_S_unknown -> WCM_P_set_code [label="set"] + WCM_P_set_code [shape="box" label="WM_set_code()"] + WCM_P_set_code -> WCM_S_known + WCM_S_known [label="known"] + + WCM_S_unknown -> WCM_P_list_nameplates [label="input"] + WCM_S_typing_nameplate [label="typing\nnameplate"] + + WCM_S_typing_nameplate -> WCM_P_nameplate_completion [label=""] + WCM_P_nameplate_completion [shape="box" label="completion?"] + WCM_P_nameplate_completion -> WCM_P_list_nameplates + WCM_P_list_nameplates [shape="box" label="NLM_update_nameplates()"] + WCM_P_list_nameplates -> WCM_S_typing_nameplate + + WCM_S_typing_nameplate -> WCM_P_got_nameplates [label="C_rx_nameplates()"] + WCM_P_got_nameplates [shape="box" label="stash nameplates\nfor completion"] + WCM_P_got_nameplates -> WCM_S_typing_nameplate + WCM_S_typing_nameplate -> WCM_P_finish_nameplate [label="finished\nnameplate"] + WCM_P_finish_nameplate [shape="box" label="lookup wordlist\nfor completion"] + WCM_P_finish_nameplate -> WCM_S_typing_code + WCM_S_typing_code [label="typing\ncode"] + WCM_S_typing_code -> WCM_P_code_completion [label=""] + WCM_P_code_completion [shape="box" label="completion"] + WCM_P_code_completion -> WCM_S_typing_code + + WCM_S_typing_code -> WCM_P_set_code [label="finished\ncode"] + + WCM_S_unknown -> WCM_P_allocate [label="allocate"] + WCM_P_allocate [shape="box" label="C_allocate_nameplate()"] + WCM_P_allocate -> WCM_S_allocate_waiting + WCM_S_allocate_waiting [label="waiting"] + WCM_S_allocate_waiting -> WCM_P_allocate_generate [label="WCM_rx_allocation()"] + WCM_P_allocate_generate [shape="box" label="generate\nrandom code"] + WCM_P_allocate_generate -> WCM_P_set_code + + /* ConnectionMachine */ + /*WCM_S_known -> CM_start [style="invis"] + CM_start [label="Connection\nMachine" style="dotted"] + CM_start -> CM_S_neither [style="invis"] + CM_S_neither [label="neither"]*/ + + + + NM_start [label="Nameplate\nMachine" style="dotted"] + NM_start -> NM_S_unclaimed [style="invis"] NM_S_unclaimed [label="no nameplate"] NM_S_unclaimed -> NM_S_unclaimed [label="NM_release()"] NM_P_set_nameplate [shape="box" label="post_claim()"] - NM_S_unclaimed -> NM_P_set_nameplate [label="set_nameplate()"] + NM_S_unclaimed -> NM_P_set_nameplate [label="NM_set_nameplate()"] NM_S_claiming [label="claim pending"] NM_P_set_nameplate -> NM_S_claiming NM_S_claiming -> NM_P_rx_claimed [label="rx claimed"] - NM_P_rx_claimed [label="set_mailbox()" shape="box"] + NM_P_rx_claimed [label="MM_set_mailbox()" shape="box"] NM_P_rx_claimed -> NM_S_claimed NM_S_claimed [label="claimed"] NM_S_claimed -> NM_P_release [label="NM_release()"] @@ -78,7 +140,9 @@ digraph { NM_S_released [label="released"] NM_S_released -> NM_S_released [label="NM_release()"] - + + MM_start [label="Mailbox\nMachine" style="dotted"] + MM_start -> MM_S_want_mailbox [style="invis"] MM_S_want_mailbox [label="want mailbox"] MM_S_want_mailbox -> MM_P_queue1 [label="MM_send()" style="dotted"] MM_P_queue1 [shape="box" style="dotted" label="queue message"] @@ -88,21 +152,36 @@ digraph { MM_P_send_queued [shape="box" label="post add() for\nqueued messages"] MM_P_open_mailbox -> MM_P_send_queued MM_P_send_queued -> MM_S_open - MM_S_open [label="open\nunused"] - MM_S_open -> MM_P_send_queued [label="MM_send()"] + MM_S_open [label="open\n(unused)"] + MM_S_open -> MM_P_send1 [label="MM_send()"] + MM_P_send1 [shape="box" label="post add()\nfor message"] + MM_P_send1 -> MM_S_open + MM_S_open -> MM_P_release1 [label="MM_close()"] + MM_P_release1 [shape="box" label="NM_release()"] + MM_P_release1 -> MM_P_close MM_S_open -> MM_P_rx [label="rx message"] - MM_P_rx [shape="box" label="W_rx_pake()\nor W_rx_msg()"] - MM_P_rx -> MM_P_release - MM_P_release [shape="box" label="NM_release()"] - MM_P_release -> MM_S_used - MM_S_used [label="open\nused"] + MM_P_rx [shape="box" label="WM_rx_pake()\nor WM_rx_msg()"] + MM_P_rx -> MM_P_release2 + MM_P_release2 [shape="box" label="NM_release()"] + MM_P_release2 -> MM_S_used + MM_S_used [label="open\n(used)"] MM_S_used -> MM_P_rx [label="rx message"] - MM_S_used -> MM_P_send [label="MM_send()"] - MM_P_send [shape="box" label="post message"] - MM_P_send -> MM_S_used + MM_S_used -> MM_P_send2 [label="MM_send()"] + MM_P_send2 [shape="box" label="post add()\nfor message"] + MM_P_send2 -> MM_S_used + MM_S_used -> MM_P_close [label="MM_close()"] + MM_P_close [shape="box" label="post_close(mood)"] + MM_P_close -> MM_S_closing + MM_S_closing [label="waiting"] + MM_S_closing -> MM_S_closing [label="MM_close()"] + MM_S_closing -> MM_S_closed [label="rx closed"] + MM_S_closed [label="closed"] + MM_S_closed -> MM_S_closed [label="MM_close()"] - /* upgrading to new PAKE algorithm */ + /* upgrading to new PAKE algorithm, the slower form (the faster form + puts the pake_abilities record in the nameplate_info message) */ + /* P2_start [label="(PAKE\nupgrade)\nstart"] P2_start -> P2_P_send_abilities [label="set_code()"] P2_P_send_abilities [shape="box" label="send pake_abilities"] @@ -119,4 +198,5 @@ digraph { P2_P_send_pakev2 [shape="box" label="send pake_v2"] P2_P_send_pakev2 -> P2_P_process_v2 [label="rx pake_v2"] P2_P_process_v2 [shape="box" label="process v2"] + */ }