... sync
authorVolker Birk <vb@pep-project.org>
Fri, 31 May 2019 01:58:02 +0200
branchsync
changeset 3791f32545eaeefc
parent 3790 7c13eebdb82c
child 3792 5fc0cce01f07
child 3794 e7f94d975542
...
sync/cond_act_sync.yml2
sync/sync.fsm
     1.1 --- a/sync/cond_act_sync.yml2	Thu May 30 23:47:52 2019 +0200
     1.2 +++ b/sync/cond_act_sync.yml2	Fri May 31 01:58:02 2019 +0200
     1.3 @@ -239,22 +239,7 @@
     1.4       
     1.5      ||
     1.6      choose {
     1.7 -    when "$type = 'SYNC_NOTIFY_TIMEOUT' or $type = 'SYNC_NOTIFY_SOLE' or $type = 'SYNC_NOTIFY_IN_GROUP'"
     1.8 -    ||
     1.9 -        pEp_identity *me = new_identity(NULL, NULL, NULL, NULL);
    1.10 -        pEp_identity *partner = new_identity(NULL, NULL, NULL, NULL);
    1.11 -        assert(me && partner);
    1.12 -        if (!(me && partner)) {
    1.13 -            free_identity(me);
    1.14 -            free_identity(partner);
    1.15 -            return PEP_OUT_OF_MEMORY;
    1.16 -        }
    1.17 -
    1.18 -        PEP_STATUS status = session->notifyHandshake(me, partner, «$type»);
    1.19 -        if (status)
    1.20 -            return status;
    1.21 -    ||
    1.22 -    otherwise
    1.23 +    when "$type = 'SYNC_NOTIFY_INIT_ADD_OUR_DEVICE' or $type = 'SYNC_NOTIFY_INIT_ADD_OTHER_DEVICE' or $type = 'SYNC_NOTIFY_INIT_FORM_GROUP'"
    1.24      ||
    1.25          assert(session->sync_state.transport.from);
    1.26          if (!session->sync_state.transport.from)
    1.27 @@ -266,7 +251,8 @@
    1.28          assert(status == PEP_STATUS_OK);
    1.29          if (status)
    1.30              return status;
    1.31 -
    1.32 +        assert(strcmp(me->fpr, session->sync_state.comm_partner.sender_fpr) != 0);
    1.33 +        
    1.34          assert(me->fpr && me->fpr[0]);
    1.35          if (!(me->fpr && me->fpr[0])) {
    1.36              free_identity(me);
    1.37 @@ -283,6 +269,7 @@
    1.38          if (session->sync_state.comm_partner.sender_fpr) {
    1.39              free(partner->fpr);
    1.40              partner->fpr = strdup(session->sync_state.comm_partner.sender_fpr);
    1.41 +            assert(partner->fpr);
    1.42              if (!partner->fpr) {
    1.43                  free_identity(me);
    1.44                  free_identity(partner);
    1.45 @@ -299,10 +286,26 @@
    1.46              return PEP_OUT_OF_MEMORY;
    1.47          }
    1.48  
    1.49 +        assert(strcmp(me->fpr, partner->fpr) != 0);
    1.50          status = session->notifyHandshake(me, partner, «$type»);
    1.51          if (status)
    1.52              return status;
    1.53      ||
    1.54 +    otherwise
    1.55 +    ||
    1.56 +        pEp_identity *me = new_identity(NULL, NULL, NULL, NULL);
    1.57 +        pEp_identity *partner = new_identity(NULL, NULL, NULL, NULL);
    1.58 +        assert(me && partner);
    1.59 +        if (!(me && partner)) {
    1.60 +            free_identity(me);
    1.61 +            free_identity(partner);
    1.62 +            return PEP_OUT_OF_MEMORY;
    1.63 +        }
    1.64 +
    1.65 +        PEP_STATUS status = session->notifyHandshake(me, partner, «$type»);
    1.66 +        if (status)
    1.67 +            return status;
    1.68 +    ||
    1.69      }
    1.70  }
    1.71  
     2.1 --- a/sync/sync.fsm	Thu May 30 23:47:52 2019 +0200
     2.2 +++ b/sync/sync.fsm	Fri May 31 01:58:02 2019 +0200
     2.3 @@ -61,7 +61,6 @@
     2.4                          // this is our own NegotiationRequest; ignore
     2.5                      }
     2.6                      else {
     2.7 -                        // first is receiving NegotiationRequest
     2.8                          do storeNegotiation;
     2.9                          // first is sending NegotiationOpen
    2.10                          send NegotiationOpen;
    2.11 @@ -75,6 +74,7 @@
    2.12  
    2.13              on NegotiationOpen if sameNegotiationAndPartner {
    2.14                  // second is receiving NegotiationOpen
    2.15 +                do storeNegotiation;
    2.16                  go HandshakingNewSecond;
    2.17              }
    2.18          }
    2.19 @@ -235,7 +235,6 @@
    2.20  
    2.21              on OwnKeysSecond {
    2.22                  do saveGroupKeys;
    2.23 -
    2.24                  do receivedKeysAreGroupKeys;
    2.25                  do showGroupCreated;
    2.26                  go Grouped;
    2.27 @@ -278,8 +277,10 @@
    2.28                  do useOwnChallenge;
    2.29              }
    2.30  
    2.31 -            on NegotiationOpen if sameNegotiationAndPartner
    2.32 +            on NegotiationOpen if sameNegotiationAndPartner {
    2.33 +                do storeNegotiation;
    2.34                  go HandshakingGrouped;
    2.35 +            }
    2.36  
    2.37              on GroupTrustThisKey {
    2.38                  do trustThisKey;