Compiling again. Need to clean up and test now. fdik_sync
authorKrista Bennett <krista@pep-project.org>
Fri, 24 Mar 2017 12:22:23 +0100
branchfdik_sync
changeset 16890579d2132265
parent 1688 713d66e2a90f
child 1690 62610d1dcbca
Compiling again. Need to clean up and test now.
src/bloblist.h
src/message_api.c
src/message_api.h
src/pgp_gpg.c
     1.1 --- a/src/bloblist.h	Thu Mar 23 13:40:32 2017 +0100
     1.2 +++ b/src/bloblist.h	Fri Mar 24 12:22:23 2017 +0100
     1.3 @@ -97,4 +97,3 @@
     1.4  #ifdef __cplusplus
     1.5  }
     1.6  #endif
     1.7 -
     2.1 --- a/src/message_api.c	Thu Mar 23 13:40:32 2017 +0100
     2.2 +++ b/src/message_api.c	Fri Mar 24 12:22:23 2017 +0100
     2.3 @@ -1136,7 +1136,7 @@
     2.4          beacon_msg->attachments = blob;
     2.5  
     2.6      PEP_STATUS status = sign_blob(session,
     2.7 -                                  beacon_msg->src->from,
     2.8 +                                  beacon_msg->from,
     2.9                                    blob,
    2.10                                    &sig_text,
    2.11                                    &sig_size);
    2.12 @@ -1147,9 +1147,10 @@
    2.13      }
    2.14      
    2.15      bloblist_t* sig = bloblist_add(blob,
    2.16 -                                  sig_size,
    2.17 -                                  "application/pEp.sync.sig",
    2.18 -                                  NULL);
    2.19 +                                   sig_text,
    2.20 +                                   sig_size,
    2.21 +                                   "application/pEp.sync.sig",
    2.22 +                                   NULL);
    2.23      
    2.24      if (!sig)
    2.25          return PEP_OUT_OF_MEMORY;
    2.26 @@ -1179,7 +1180,6 @@
    2.27  PEP_STATUS verify_beacon_message(PEP_SESSION session,
    2.28                                   message* beacon_msg,
    2.29                                   char** signer_fpr)
    2.30 -                              ) 
    2.31  {
    2.32      if (!session || !beacon_msg || !signer_fpr ||
    2.33          !(is_beacon_message(beacon_msg)))
    2.34 @@ -1209,8 +1209,8 @@
    2.35          
    2.36      stringlist_t* _verify_keylist = NULL;
    2.37  
    2.38 -    status = verify_text(session, beacon->value,
    2.39 -                         beacon_size, sig->value, 
    2.40 +    PEP_STATUS status = verify_text(session, beacon->value,
    2.41 +                         beacon->size, sig->value, 
    2.42                           sig->size, &_verify_keylist);
    2.43  
    2.44      if (status != PEP_VERIFIED && status != PEP_VERIFIED_AND_TRUSTED)
    2.45 @@ -1230,8 +1230,8 @@
    2.46  
    2.47  
    2.48  PEP_STATUS sign_blob(PEP_SESSION session,
    2.49 -                     pEp_identity signer_id,
    2.50 -                     bloblist_t blob,
    2.51 +                     pEp_identity* signer_id,
    2.52 +                     bloblist_t* blob,
    2.53                       char** signature,
    2.54                       size_t* sig_size
    2.55                   ) 
    2.56 @@ -1239,7 +1239,7 @@
    2.57      if (!session || !blob || !signature || !sig_size)
    2.58          return PEP_ILLEGAL_VALUE;
    2.59          
    2.60 -    PEP_STATUS = PEP_KEY_NOT_FOUND:
    2.61 +    PEP_STATUS status = PEP_KEY_NOT_FOUND;
    2.62      
    2.63      status = myself(session, signer_id);
    2.64      if (status != PEP_STATUS_OK)
    2.65 @@ -1258,7 +1258,7 @@
    2.66      if (status == PEP_OUT_OF_MEMORY)
    2.67         goto enomem;
    2.68  
    2.69 -    if (status != PEP_STATUS_OK || ctext == NULL)
    2.70 +    if (status != PEP_STATUS_OK || *signature == NULL)
    2.71        goto pep_error;
    2.72        
    2.73      free_stringlist(keys);
    2.74 @@ -1276,6 +1276,9 @@
    2.75  }
    2.76  
    2.77  // N.B. never tested.
    2.78 +// FIXME: this only signs the plaintext, which isn't
    2.79 +//        compatible with detached sigs and rfc3156. We
    2.80 +//        need to decide if we want this in at all.
    2.81  PEP_STATUS sign_message(PEP_SESSION session,
    2.82                          message *src,
    2.83                          message **dst
     3.1 --- a/src/message_api.h	Thu Mar 23 13:40:32 2017 +0100
     3.2 +++ b/src/message_api.h	Fri Mar 24 12:22:23 2017 +0100
     3.3 @@ -21,8 +21,8 @@
     3.4  void attach_own_key(PEP_SESSION session, message *msg);
     3.5  
     3.6  PEP_STATUS sign_blob(PEP_SESSION session,
     3.7 -                     void* blob,
     3.8 -                     size_t blob_size,
     3.9 +                     pEp_identity* signer_id,
    3.10 +                     bloblist_t* blob,
    3.11                       char** signature,
    3.12                       size_t* sig_size);
    3.13  
    3.14 @@ -34,7 +34,16 @@
    3.15  PEP_STATUS sign_message(PEP_SESSION session,
    3.16                          message *src,
    3.17                          message **dst);
    3.18 -                                            
    3.19 +
    3.20 +PEP_STATUS verify_beacon_message(PEP_SESSION session,
    3.21 +                                 message* beacon_msg,
    3.22 +                                 char** signer_fpr);
    3.23 +
    3.24 +PEP_STATUS prepare_beacon_message(PEP_SESSION session,
    3.25 +                                  char* beacon_blob,
    3.26 +                                  size_t beacon_size,
    3.27 +                                  message* beacon_msg); 
    3.28 +            
    3.29  /* checks if a message is correctly signend
    3.30  with a key that has a UID with the email address of message.from. If
    3.31  result is PEP_VERIFIED, it additionally delivers fpr of the signature
     4.1 --- a/src/pgp_gpg.c	Thu Mar 23 13:40:32 2017 +0100
     4.2 +++ b/src/pgp_gpg.c	Fri Mar 24 12:22:23 2017 +0100
     4.3 @@ -1064,7 +1064,7 @@
     4.4      gpgme_error_t gpgme_error;
     4.5      gpgme_data_t plain, detached_sig;
     4.6      gpgme_key_t *rcpt;
     4.7 -    gpgme_sig_mode_t GPGME_SIG_MODE_DETACH;
     4.8 +    gpgme_sig_mode_t sig_mode = GPGME_SIG_MODE_DETACH;
     4.9      const stringlist_t *_keylist;
    4.10      int i, j;
    4.11