merge sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Thu, 02 May 2019 11:23:41 +0200
branchsync
changeset 36044bf5759ea073
parent 3603 1546d058cd26
parent 3602 65065c61bae9
child 3605 27595b58666d
child 3616 8229562ff2a1
merge
     1.1 --- a/sync/cond_act_sync.yml2	Thu May 02 11:23:22 2019 +0200
     1.2 +++ b/sync/cond_act_sync.yml2	Thu May 02 11:23:41 2019 +0200
     1.3 @@ -122,14 +122,26 @@
     1.4      ||
     1.5  }
     1.6  
     1.7 -action newChallenge
     1.8 +action newChallenge {
     1.9 +    // random new challenge
    1.10      call "new_UUID" with "dst" > &session->own_sync_state.challenge
    1.11 +    // store a copy of this challenge
    1.12 +    call "copy_UUID" {
    1.13 +        with "src" > &session->own_sync_state.challenge
    1.14 +        with "dst" > &session->sync_state.common.challenge
    1.15 +    }
    1.16 +}
    1.17  
    1.18 -action storeChallenge call "copy_UUID" {
    1.19 +action replyChallenge call "copy_UUID" {
    1.20      with "src" > &session->sync_state.keysync.challenge
    1.21      with "dst" > &session->own_sync_state.challenge
    1.22  }
    1.23  
    1.24 +action useOwnChallenge call "copy_UUID" {
    1.25 +    with "src" > &session->sync_state.common.challenge
    1.26 +    with "dst" > &session->own_sync_state.challenge
    1.27 +}
    1.28 +
    1.29  action newTransaction {
    1.30  ||
    1.31      // sender key must be stable while transaction
     2.1 --- a/sync/gen_message_func.ysl2	Thu May 02 11:23:22 2019 +0200
     2.2 +++ b/sync/gen_message_func.ysl2	Thu May 02 11:23:41 2019 +0200
     2.3 @@ -42,6 +42,9 @@
     2.4      // common buffer for all types of «@name» messages
     2.5  
     2.6      struct common_state_s {
     2.7 +        // intermediate store own challenge
     2.8 +        TID_t challenge;
     2.9 +
    2.10          // transport data
    2.11          pEp_identity *from;
    2.12          char *signature_fpr;
     3.1 --- a/sync/sync.fsm	Thu May 02 11:23:22 2019 +0200
     3.2 +++ b/sync/sync.fsm	Thu May 02 11:23:41 2019 +0200
     3.3 @@ -29,11 +29,13 @@
     3.4                  send Beacon;
     3.5              }
     3.6  
     3.7 -            on KeyGen
     3.8 +            on KeyGen {
     3.9                  send Beacon;
    3.10 +            }
    3.11  
    3.12 -            on CannotDecrypt // cry baby
    3.13 +            on CannotDecrypt { // cry baby
    3.14                  send Beacon;
    3.15 +            }
    3.16  
    3.17              on Beacon {
    3.18                  if sameChallenge {
    3.19 @@ -44,7 +46,7 @@
    3.20                          send Beacon;
    3.21                      }
    3.22                      else /* we are second */ {
    3.23 -                        do storeChallenge; // partner's challenge
    3.24 +                        do replyChallenge; // partner's challenge
    3.25                          do newTransaction;
    3.26                          do tellWeAreNotGrouped;
    3.27                          // second is sending NegotiationRequest
    3.28 @@ -53,18 +55,20 @@
    3.29                  }
    3.30              }
    3.31  
    3.32 -            on NegotiationRequest if challengeAccepted {
    3.33 -                if sameTransaction {
    3.34 -                    // this is our own NegotiationRequest; ignore
    3.35 -                }
    3.36 -                else {
    3.37 -                    // first is receiving NegotiationRequest
    3.38 -                    do storeTransaction;
    3.39 -                    // first is sending NegotiationOpen
    3.40 -                    send NegotiationOpen;
    3.41 -                    if partnerIsGrouped
    3.42 -                        go HandshakingWithGroup;
    3.43 -                    go HandshakingNewFirst;
    3.44 +            on NegotiationRequest {
    3.45 +                if challengeAccepted {
    3.46 +                    if sameTransaction {
    3.47 +                        // this is our own NegotiationRequest; ignore
    3.48 +                    }
    3.49 +                    else {
    3.50 +                        // first is receiving NegotiationRequest
    3.51 +                        do storeTransaction;
    3.52 +                        // first is sending NegotiationOpen
    3.53 +                        send NegotiationOpen;
    3.54 +                        if partnerIsGrouped
    3.55 +                            go HandshakingWithGroup;
    3.56 +                        go HandshakingNewFirst;
    3.57 +                    }
    3.58                  }
    3.59              }
    3.60  
    3.61 @@ -273,7 +277,7 @@
    3.62              }
    3.63  
    3.64              on Beacon {
    3.65 -                do storeChallenge;
    3.66 +                do replyChallenge;
    3.67                  do newTransaction;
    3.68                  do tellWeAreGrouped;
    3.69                  send NegotiationRequest;