... sync
authorVolker Birk <vb@pep-project.org>
Wed, 29 May 2019 23:43:37 +0200
branchsync
changeset 3781bcf9649b3b41
parent 3780 e4d673d3038e
child 3782 93bee764e48e
...
sync/cond_act_sync.yml2
sync/sync.fsm
     1.1 --- a/sync/cond_act_sync.yml2	Wed May 29 23:29:43 2019 +0200
     1.2 +++ b/sync/cond_act_sync.yml2	Wed May 29 23:43:37 2019 +0200
     1.3 @@ -93,10 +93,12 @@
     1.4  function "new_UUID" {
     1.5      param "dst";
     1.6      ||
     1.7 -        pEpUUID c;
     1.8 -        uuid_generate_random(c);
     1.9 +        {
    1.10 +            pEpUUID c;
    1.11 +            uuid_generate_random(c);
    1.12  
    1.13 -        OCTET_STRING_fromBuf(«$dst», (char *) c, 16);
    1.14 +            OCTET_STRING_fromBuf(«$dst», (char *) c, 16);
    1.15 +        }
    1.16      ||
    1.17  }
    1.18  
    1.19 @@ -133,14 +135,16 @@
    1.20      ||
    1.21  }
    1.22  
    1.23 -action newChallenge {
    1.24 +action newChallengeAndNegotiationBase {
    1.25      // random new challenge
    1.26      call "new_UUID" with "dst" > &session->sync_state.own.challenge
    1.27 -}
    1.28 +    call "copy_UUID" {
    1.29 +        with "src" > &session->sync_state.own.challenge
    1.30 +        with "dst" > &session->sync_state.keysync.challenge
    1.31 +    }
    1.32  
    1.33 -action replyChallenge call "copy_UUID" {
    1.34 -    with "src" > &session->sync_state.keysync.challenge
    1.35 -    with "dst" > &session->sync_state.comm_partner.challenge
    1.36 +    // this is the random data we are using as a base
    1.37 +    call "new_UUID" with "dst" > &session->sync_state.own.negotiation
    1.38  }
    1.39  
    1.40  action useOwnChallenge call "copy_UUID" {
    1.41 @@ -148,7 +152,7 @@
    1.42      with "dst" > &session->sync_state.keysync.challenge
    1.43  }
    1.44  
    1.45 -action newNegotiation {
    1.46 +action openNegotiation {
    1.47  ||
    1.48      // sender key must be stable while transaction
    1.49  
    1.50 @@ -170,11 +174,7 @@
    1.51      // we derive the actual Negotiation TID by having random data and XORing it
    1.52      // with comm_partner's Challenge
    1.53  
    1.54 -    // this is the random data we are using as a base
    1.55 -
    1.56 -    call "new_UUID" with "dst" > &session->sync_state.own.negotiation
    1.57 -
    1.58 -    // copy this into the buffer
    1.59 +    // copy Negotiation base into buffer
    1.60  
    1.61      call "copy_UUID" {
    1.62          with "src" > &session->sync_state.own.negotiation
     2.1 --- a/sync/sync.fsm	Wed May 29 23:29:43 2019 +0200
     2.2 +++ b/sync/sync.fsm	Wed May 29 23:43:37 2019 +0200
     2.3 @@ -24,7 +24,7 @@
     2.4          state Sole timeout=off {
     2.5              on Init {
     2.6                  do closeNegotiation;
     2.7 -                do newChallenge;
     2.8 +                do newChallengeAndNegotiationBase;
     2.9                  do showBeingSole;
    2.10                  send Beacon;
    2.11              }
    2.12 @@ -47,7 +47,7 @@
    2.13                          send Beacon;
    2.14                      }
    2.15                      else /* we are second */ {
    2.16 -                        do newNegotiation;
    2.17 +                        do openNegotiation;
    2.18                          do tellWeAreNotGrouped;
    2.19                          // second is sending NegotiationRequest
    2.20                          send NegotiationRequest;
    2.21 @@ -267,7 +267,7 @@
    2.22          state Grouped timeout=off {
    2.23              on Init {
    2.24                  do closeNegotiation;
    2.25 -                do newChallenge;
    2.26 +                do newChallengeAndNegotiationBase;
    2.27                  do showBeingInGroup;
    2.28              }
    2.29  
    2.30 @@ -280,7 +280,7 @@
    2.31              }
    2.32  
    2.33              on Beacon {
    2.34 -                do newNegotiation;
    2.35 +                do openNegotiation;
    2.36                  do tellWeAreGrouped;
    2.37                  send NegotiationRequest;
    2.38                  do useOwnChallenge;