KeySync: changed handshakeRequest and groupKeys messages content (TODO:increment protocol number when finished). Now use string instead of Identity to just store uuid. Added group uuid in handshakeRequest GroupMerge
authorEdouard Tisserant <edouard@pep-project.org>
Mon, 13 Feb 2017 21:26:55 +0100
branchGroupMerge
changeset 1585655cfb838ac6
parent 1575 ae0c4b0953a5
child 1586 599deda50386
KeySync: changed handshakeRequest and groupKeys messages content (TODO:increment protocol number when finished). Now use string instead of Identity to just store uuid. Added group uuid in handshakeRequest
asn.1/devicegroup.asn1
src/sync_impl.c
sync/gen_actions.ysl2
sync/generated/sync_send_actions.c
     1.1 --- a/asn.1/devicegroup.asn1	Mon Feb 13 00:07:28 2017 +0100
     1.2 +++ b/asn.1/devicegroup.asn1	Mon Feb 13 21:26:55 2017 +0100
     1.3 @@ -14,11 +14,12 @@
     1.4  Beacon ::= NULL
     1.5  
     1.6  HandshakeRequest ::= SEQUENCE {
     1.7 -    partner Identity /* identity of the receiver */
     1.8 +    partner-id     UTF8String  (SIZE(1..1024)) OPTIONAL,
     1.9 +    group-id       UTF8String  (SIZE(1..1024)) OPTIONAL
    1.10  }
    1.11  
    1.12  GroupKeys ::= SEQUENCE {
    1.13 -    partner Identity, /* identity of the receiver */
    1.14 +    partner-id     UTF8String  (SIZE(1..1024)) OPTIONAL,
    1.15      ownIdentities IdentityList
    1.16  }
    1.17  
     2.1 --- a/src/sync_impl.c	Mon Feb 13 00:07:28 2017 +0100
     2.2 +++ b/src/sync_impl.c	Mon Feb 13 21:26:55 2017 +0100
     2.3 @@ -65,8 +65,8 @@
     2.4              case DeviceGroup_Protocol__payload_PR_handshakeRequest:
     2.5                  // re-check uuid in case sync_uuid changed while in the queue
     2.6                  if (strncmp(session->sync_uuid,
     2.7 -                            (const char *)msg->payload.choice.handshakeRequest.partner.user_id->buf,
     2.8 -                            msg->payload.choice.handshakeRequest.partner.user_id->size) != 0){
     2.9 +                            (const char *)msg->payload.choice.handshakeRequest.partner_id->buf,
    2.10 +                            msg->payload.choice.handshakeRequest.partner_id->size) != 0){
    2.11                      status = PEP_SYNC_ILLEGAL_MESSAGE;
    2.12                      goto error;
    2.13                  }
    2.14 @@ -80,8 +80,8 @@
    2.15              case DeviceGroup_Protocol__payload_PR_groupKeys:
    2.16                  // re-check uuid in case sync_uuid changed while in the queue
    2.17                  if (strncmp(session->sync_uuid,
    2.18 -                            (const char *)msg->payload.choice.groupKeys.partner.user_id->buf,
    2.19 -                            msg->payload.choice.groupKeys.partner.user_id->size) != 0){
    2.20 +                            (const char *)msg->payload.choice.groupKeys.partner_id->buf,
    2.21 +                            msg->payload.choice.groupKeys.partner_id->size) != 0){
    2.22                      status = PEP_SYNC_ILLEGAL_MESSAGE;
    2.23                      goto error;
    2.24                  }
    2.25 @@ -374,8 +374,8 @@
    2.26                          case DeviceGroup_Protocol__payload_PR_handshakeRequest:
    2.27                              if (rating < PEP_rating_reliable ||
    2.28                                  strncmp(session->sync_uuid,
    2.29 -                                        (const char *)msg->payload.choice.handshakeRequest.partner.user_id->buf,
    2.30 -                                        msg->payload.choice.handshakeRequest.partner.user_id->size) != 0){
    2.31 +                                        (const char *)msg->payload.choice.handshakeRequest.partner_id->buf,
    2.32 +                                        msg->payload.choice.handshakeRequest.partner_id->size) != 0){
    2.33                                  discard = true;
    2.34                                  goto free_all;
    2.35                              }
    2.36 @@ -387,8 +387,8 @@
    2.37                              if (!keylist || rating < PEP_rating_reliable ||
    2.38                                  // message is only consumed by instance it is addressed to
    2.39                                  (strncmp(session->sync_uuid,
    2.40 -                                        (const char *)msg->payload.choice.groupKeys.partner.user_id->buf,
    2.41 -                                        msg->payload.choice.groupKeys.partner.user_id->size) != 0)){
    2.42 +                                        (const char *)msg->payload.choice.groupKeys.partner_id->buf,
    2.43 +                                        msg->payload.choice.groupKeys.partner_id->size) != 0)){
    2.44                                  discard = true;
    2.45                                  goto free_all;
    2.46                              }
     3.1 --- a/sync/gen_actions.ysl2	Mon Feb 13 00:07:28 2017 +0100
     3.2 +++ b/sync/gen_actions.ysl2	Mon Feb 13 21:26:55 2017 +0100
     3.3 @@ -198,9 +198,11 @@
     3.4          choose {
     3.5              when "$name='GroupKeys' or $name='HandshakeRequest'" {
     3.6                  |
     3.7 -                |> if (Identity_from_Struct(partner,
     3.8 -                |>                          &msg->payload.choice.«$lname».partner) == NULL)
     3.9 -                |>> goto enomem;
    3.10 +                |> msg->payload.choice.«$lname».partner_id = 
    3.11 +                |>     OCTET_STRING_new_fromBuf(&asn_DEF_UTF8String,
    3.12 +                |>                              partner->user_id, -1);
    3.13 +                |> if (partner->user_id && !msg->payload.choice.«$lname».partner_id)
    3.14 +                |>    goto enomem;
    3.15              }
    3.16          }
    3.17          ||
     4.1 --- a/sync/generated/sync_send_actions.c	Mon Feb 13 00:07:28 2017 +0100
     4.2 +++ b/sync/generated/sync_send_actions.c	Mon Feb 13 21:26:55 2017 +0100
     4.3 @@ -86,9 +86,11 @@
     4.4      if (!msg)
     4.5          goto enomem;
     4.6  
     4.7 -    if (Identity_from_Struct(partner,
     4.8 -                             &msg->payload.choice.handshakeRequest.partner) == NULL)
     4.9 -        goto enomem;
    4.10 +    msg->payload.choice.handshakeRequest.partner_id = 
    4.11 +        OCTET_STRING_new_fromBuf(&asn_DEF_UTF8String,
    4.12 +                                 partner->user_id, -1);
    4.13 +    if (partner->user_id && !msg->payload.choice.handshakeRequest.partner_id)
    4.14 +       goto enomem;
    4.15  
    4.16      bool encrypted = true;
    4.17      status = unicast_msg(session, partner, state, msg, encrypted);
    4.18 @@ -140,9 +142,11 @@
    4.19      if (IdentityList_from_identity_list(kl, &msg->payload.choice.groupKeys.ownIdentities) == NULL)
    4.20          goto enomem;
    4.21  
    4.22 -    if (Identity_from_Struct(partner,
    4.23 -                             &msg->payload.choice.groupKeys.partner) == NULL)
    4.24 -        goto enomem;
    4.25 +    msg->payload.choice.groupKeys.partner_id = 
    4.26 +        OCTET_STRING_new_fromBuf(&asn_DEF_UTF8String,
    4.27 +                                 partner->user_id, -1);
    4.28 +    if (partner->user_id && !msg->payload.choice.groupKeys.partner_id)
    4.29 +       goto enomem;
    4.30  
    4.31      bool encrypted = true;
    4.32      status = unicast_msg(session, partner, state, msg, encrypted);