adding trust check on outgoing side keysync
authorVolker Birk <vb@pep.foundation>
Wed, 31 Aug 2016 10:13:37 +0200
branchkeysync
changeset 1101a9e46b630bf4
parent 1100 bb146737405f
child 1102 9fdf0e11bf18
adding trust check on outgoing side
src/pEpEngine.h
src/sync_impl.c
     1.1 --- a/src/pEpEngine.h	Wed Aug 31 09:41:23 2016 +0200
     1.2 +++ b/src/pEpEngine.h	Wed Aug 31 10:13:37 2016 +0200
     1.3 @@ -81,6 +81,7 @@
     1.4      PEP_OWN_SEQUENCE                                = 0x097f,
     1.5  
     1.6      PEP_SYNC_STATEMACHINE_ERROR                     = 0x0980,
     1.7 +    PEP_SYNC_NO_TRUST                               = 0x0981,
     1.8      PEP_STATEMACHINE_INVALID_STATE                  = 0x0982,
     1.9      PEP_STATEMACHINE_INVALID_EVENT                  = 0x0983,
    1.10      PEP_STATEMACHINE_INVALID_CONDITION              = 0x0984,
     2.1 --- a/src/sync_impl.c	Wed Aug 31 09:41:23 2016 +0200
     2.2 +++ b/src/sync_impl.c	Wed Aug 31 10:13:37 2016 +0200
     2.3 @@ -242,6 +242,17 @@
     2.4      me = NULL;
     2.5  
     2.6      if (encrypted) {
     2.7 +        if (msg->payload.present == DeviceGroup_Protocol__payload_PR_groupKeys) {
     2.8 +            PEP_rating rating = PEP_rating_undefined;
     2.9 +            status = outgoing_message_rating(session, _message, &rating);
    2.10 +            if (status != PEP_STATUS_OK)
    2.11 +                goto error;
    2.12 +            if (rating < PEP_rating_trusted) {
    2.13 +                status = PEP_SYNC_NO_TRUST;
    2.14 +                goto error;
    2.15 +            }
    2.16 +        }
    2.17 +
    2.18          message *_encrypted = NULL;
    2.19          status = encrypt_message(session, _message, NULL, &_encrypted, PEP_enc_PEP, 0);
    2.20          if (status != PEP_STATUS_OK)