encrypt at last keysync
authorVolker Birk <vb@pep.foundation>
Tue, 23 Aug 2016 19:20:08 +0200
branchkeysync
changeset 10767a80153bfc5a
parent 1075 6ac3fd936e93
child 1077 d22b9d70370d
encrypt at last
src/sync_impl.c
     1.1 --- a/src/sync_impl.c	Tue Aug 23 18:54:46 2016 +0200
     1.2 +++ b/src/sync_impl.c	Tue Aug 23 19:20:08 2016 +0200
     1.3 @@ -2,6 +2,7 @@
     1.4  #include "sync_impl.h"
     1.5  #include "pEp_internal.h"
     1.6  #include "keymanagement.h"
     1.7 +#include "message_api.h"
     1.8  #include "map_asn1.h"
     1.9  #include "baseprotocol.h"
    1.10  
    1.11 @@ -174,13 +175,19 @@
    1.12      if (status != PEP_STATUS_OK)
    1.13          goto error;
    1.14      payload = NULL;
    1.15 -
    1.16      free_identity(me);
    1.17      me = NULL;
    1.18 +    free_identity(partner);
    1.19 +    partner = NULL;
    1.20  
    1.21 -    status = session->messageToSend(session->sync_obj, _message);
    1.22 +    message *_encrypted = NULL;
    1.23 +    status = encrypt_message(session, _message, NULL, &_encrypted, PEP_enc_PEP, 0);
    1.24 +    if (status != PEP_STATUS_OK)
    1.25 +        goto error;
    1.26 +    free_message(_message);
    1.27 +    _message = NULL;
    1.28  
    1.29 -    free_identity(partner);
    1.30 +    status = session->messageToSend(session->sync_obj, _encrypted);
    1.31      return status;
    1.32  
    1.33  enomem: