sign_blob, verify_blob, verify_beacon_message, prepare_beacon_message are all in and tested. Old funcs commented out. Will be removed in next commit. fdik_sync
authorKrista Bennett <krista@pep-project.org>
Sat, 25 Mar 2017 11:27:35 +0100
branchfdik_sync
changeset 169823fd29bafbc3
parent 1692 69823df184cf
child 1699 6fb3820c4f77
sign_blob, verify_blob, verify_beacon_message, prepare_beacon_message are all in and tested. Old funcs commented out. Will be removed in next commit.
src/message_api.c
src/message_api.h
     1.1 --- a/src/message_api.c	Fri Mar 24 15:47:07 2017 +0100
     1.2 +++ b/src/message_api.c	Sat Mar 25 11:27:35 2017 +0100
     1.3 @@ -1081,35 +1081,6 @@
     1.4      }
     1.5  }
     1.6  
     1.7 -// FIXME; We unfortunately will have to do something like this.
     1.8 -// PEP_cryptotech determine_signing_format(message *msg)
     1.9 -// {
    1.10 -//     assert(msg);
    1.11 -// 
    1.12 -//     if (is_PGP_message_text(msg->longmsg)) {
    1.13 -//         msg->enc_format = PEP_enc_pieces;
    1.14 -//         return PEP_crypt_OpenPGP;
    1.15 -//     }
    1.16 -//     else if (msg->attachments && msg->attachments->next &&
    1.17 -//             is_mime_type(msg->attachments, "application/pgp-encrypted") &&
    1.18 -//             is_PGP_message_text(msg->attachments->next->value)
    1.19 -//         ) {
    1.20 -//         msg->enc_format = PEP_enc_PGP_MIME;
    1.21 -//         return PEP_crypt_OpenPGP;
    1.22 -//     }
    1.23 -//     else if (msg->attachments && msg->attachments->next &&
    1.24 -//             is_mime_type(msg->attachments->next, "application/pgp-encrypted") &&
    1.25 -//             is_PGP_message_text(msg->attachments->value)
    1.26 -//         ) {
    1.27 -//         msg->enc_format = PEP_enc_PGP_MIME_Outlook1;
    1.28 -//         return PEP_crypt_OpenPGP;
    1.29 -//     }
    1.30 -//     else {
    1.31 -//         msg->enc_format = PEP_enc_none;
    1.32 -//         return PEP_crypt_none;
    1.33 -//     }
    1.34 -// }
    1.35 -// 
    1.36  PEP_STATUS prepare_beacon_message(PEP_SESSION session,
    1.37                                    char* beacon_blob,
    1.38                                    size_t beacon_size,
    1.39 @@ -1275,134 +1246,134 @@
    1.40  
    1.41  }
    1.42  
    1.43 -// N.B. never tested.
    1.44 -// FIXME: this only signs the plaintext, which isn't
    1.45 -//        compatible with detached sigs and rfc3156. We
    1.46 -//        need to decide if we want this in at all.
    1.47 -PEP_STATUS sign_message(PEP_SESSION session,
    1.48 -                        message *src,
    1.49 -                        message **dst
    1.50 -                    ) 
    1.51 -{   
    1.52 -    if (!dst)
    1.53 -        return PEP_ILLEGAL_VALUE;
    1.54 -        
    1.55 -    PEP_STATUS status = PEP_KEY_NOT_FOUND;                         
    1.56 -
    1.57 -    assert(session);
    1.58 -    assert(src);
    1.59 -    assert(dst);
    1.60 -
    1.61 -    if (!(session && src && dst))
    1.62 -        return PEP_ILLEGAL_VALUE;
    1.63 -
    1.64 -    if (src->dir == PEP_dir_incoming || !(src->from))
    1.65 -        return PEP_ILLEGAL_VALUE;
    1.66 -
    1.67 -    message * msg = NULL;
    1.68 -    stringlist_t * keys = NULL;
    1.69 -
    1.70 -    determine_encryption_format(src);
    1.71 -    if (src->enc_format != PEP_enc_none)
    1.72 -        return PEP_ILLEGAL_VALUE;
    1.73 -
    1.74 -    *dst = NULL;
    1.75 -
    1.76 -    status = myself(session, src->from);
    1.77 -    if (status != PEP_STATUS_OK)
    1.78 -        goto pep_error;
    1.79 -
    1.80 -    if (!src->from->fpr)
    1.81 -        return PEP_KEY_NOT_FOUND;
    1.82 -        
    1.83 -    keys = new_stringlist(src->from->fpr);
    1.84 -    if (keys == NULL)
    1.85 -        goto enomem;
    1.86 -
    1.87 -    msg = clone_to_empty_message(src);
    1.88 -    if (msg == NULL)
    1.89 -        goto enomem;
    1.90 -
    1.91 -    attach_own_key(session, src);
    1.92 -
    1.93 -    char *ptext = NULL;
    1.94 -    char *ctext = NULL;
    1.95 -    char *mimetext = NULL;
    1.96 -    size_t csize;
    1.97 -    assert(dst->longmsg == NULL);
    1.98 -    msg->enc_format = PEP_enc_none;
    1.99 -
   1.100 -    msg->shortmsg = strdup(src->shortmsg);
   1.101 -    assert(msg->shortmsg);
   1.102 -    if (msg->shortmsg == NULL)
   1.103 -        goto enomem;
   1.104 -    ptext = src->longmsg;
   1.105 -
   1.106 -    message *_src = calloc(1, sizeof(message));
   1.107 -    assert(_src);
   1.108 -    if (_src == NULL)
   1.109 -        goto enomem;
   1.110 -    _src->longmsg = ptext;
   1.111 -    _src->longmsg_formatted = src->longmsg_formatted;
   1.112 -    _src->attachments = src->attachments; // key will get attached here
   1.113 -    _src->enc_format = PEP_enc_none;
   1.114 -    status = mime_encode_message(_src, true, &mimetext);
   1.115 -    assert(status == PEP_STATUS_OK);
   1.116 -    if (status != PEP_STATUS_OK)
   1.117 -        goto pep_error;
   1.118 -
   1.119 -    free(_src);
   1.120 -    assert(mimetext);
   1.121 -    if (mimetext == NULL)
   1.122 -        goto pep_error;
   1.123 -
   1.124 -    status = sign_text(session, keys, mimetext, strlen(mimetext),
   1.125 -                       &ctext, &csize);
   1.126 -                       
   1.127 -    free(mimetext);
   1.128 -                       
   1.129 -    if (status == PEP_OUT_OF_MEMORY)
   1.130 -        goto enomem;
   1.131 -
   1.132 -    if (status != PEP_STATUS_OK || ctext == NULL)
   1.133 -       goto pep_error;
   1.134 -
   1.135 -    msg->longmsg = strndup(ctext, csize);
   1.136 -    assert(msg->longmsg);
   1.137 -    if (msg->longmsg == NULL)
   1.138 -        goto enomem;
   1.139 -
   1.140 -    free_stringlist(keys);
   1.141 -
   1.142 -    if (msg && msg->shortmsg == NULL) {
   1.143 -        msg->shortmsg = strdup(src->shortmsg);
   1.144 -        assert(msg->shortmsg);
   1.145 -        if (msg->shortmsg == NULL)
   1.146 -            goto enomem;
   1.147 -    }
   1.148 -
   1.149 -    if (msg) {
   1.150 -        decorate_message(msg, PEP_rating_undefined, NULL);
   1.151 -        if (src->id) {
   1.152 -            msg->id = strdup(src->id);
   1.153 -            assert(msg->id);
   1.154 -            if (msg->id == NULL)
   1.155 -                goto enomem;
   1.156 -        }
   1.157 -    }
   1.158 -
   1.159 -    *dst = msg;
   1.160 -    return status;
   1.161 -
   1.162 -enomem:
   1.163 -    status = PEP_OUT_OF_MEMORY;
   1.164 -
   1.165 -pep_error:
   1.166 -    free_stringlist(keys);
   1.167 -    free_message(msg);
   1.168 -
   1.169 -    return status;
   1.170 -}
   1.171 +// // N.B. never tested.
   1.172 +// // FIXME: this only signs the plaintext, which isn't
   1.173 +// //        compatible with detached sigs and rfc3156. We
   1.174 +// //        need to decide if we want this in at all.
   1.175 +// PEP_STATUS sign_message(PEP_SESSION session,
   1.176 +//                         message *src,
   1.177 +//                         message **dst
   1.178 +//                     ) 
   1.179 +// {   
   1.180 +//     if (!dst)
   1.181 +//         return PEP_ILLEGAL_VALUE;
   1.182 +//         
   1.183 +//     PEP_STATUS status = PEP_KEY_NOT_FOUND;                         
   1.184 +// 
   1.185 +//     assert(session);
   1.186 +//     assert(src);
   1.187 +//     assert(dst);
   1.188 +// 
   1.189 +//     if (!(session && src && dst))
   1.190 +//         return PEP_ILLEGAL_VALUE;
   1.191 +// 
   1.192 +//     if (src->dir == PEP_dir_incoming || !(src->from))
   1.193 +//         return PEP_ILLEGAL_VALUE;
   1.194 +// 
   1.195 +//     message * msg = NULL;
   1.196 +//     stringlist_t * keys = NULL;
   1.197 +// 
   1.198 +//     determine_encryption_format(src);
   1.199 +//     if (src->enc_format != PEP_enc_none)
   1.200 +//         return PEP_ILLEGAL_VALUE;
   1.201 +// 
   1.202 +//     *dst = NULL;
   1.203 +// 
   1.204 +//     status = myself(session, src->from);
   1.205 +//     if (status != PEP_STATUS_OK)
   1.206 +//         goto pep_error;
   1.207 +// 
   1.208 +//     if (!src->from->fpr)
   1.209 +//         return PEP_KEY_NOT_FOUND;
   1.210 +//         
   1.211 +//     keys = new_stringlist(src->from->fpr);
   1.212 +//     if (keys == NULL)
   1.213 +//         goto enomem;
   1.214 +// 
   1.215 +//     msg = clone_to_empty_message(src);
   1.216 +//     if (msg == NULL)
   1.217 +//         goto enomem;
   1.218 +// 
   1.219 +//     attach_own_key(session, src);
   1.220 +// 
   1.221 +//     char *ptext = NULL;
   1.222 +//     char *ctext = NULL;
   1.223 +//     char *mimetext = NULL;
   1.224 +//     size_t csize;
   1.225 +//     assert(dst->longmsg == NULL);
   1.226 +//     msg->enc_format = PEP_enc_none;
   1.227 +// 
   1.228 +//     msg->shortmsg = strdup(src->shortmsg);
   1.229 +//     assert(msg->shortmsg);
   1.230 +//     if (msg->shortmsg == NULL)
   1.231 +//         goto enomem;
   1.232 +//     ptext = src->longmsg;
   1.233 +// 
   1.234 +//     message *_src = calloc(1, sizeof(message));
   1.235 +//     assert(_src);
   1.236 +//     if (_src == NULL)
   1.237 +//         goto enomem;
   1.238 +//     _src->longmsg = ptext;
   1.239 +//     _src->longmsg_formatted = src->longmsg_formatted;
   1.240 +//     _src->attachments = src->attachments; // key will get attached here
   1.241 +//     _src->enc_format = PEP_enc_none;
   1.242 +//     status = mime_encode_message(_src, true, &mimetext);
   1.243 +//     assert(status == PEP_STATUS_OK);
   1.244 +//     if (status != PEP_STATUS_OK)
   1.245 +//         goto pep_error;
   1.246 +// 
   1.247 +//     free(_src);
   1.248 +//     assert(mimetext);
   1.249 +//     if (mimetext == NULL)
   1.250 +//         goto pep_error;
   1.251 +// 
   1.252 +//     status = sign_text(session, keys, mimetext, strlen(mimetext),
   1.253 +//                        &ctext, &csize);
   1.254 +//                        
   1.255 +//     free(mimetext);
   1.256 +//                        
   1.257 +//     if (status == PEP_OUT_OF_MEMORY)
   1.258 +//         goto enomem;
   1.259 +// 
   1.260 +//     if (status != PEP_STATUS_OK || ctext == NULL)
   1.261 +//        goto pep_error;
   1.262 +// 
   1.263 +//     msg->longmsg = strndup(ctext, csize);
   1.264 +//     assert(msg->longmsg);
   1.265 +//     if (msg->longmsg == NULL)
   1.266 +//         goto enomem;
   1.267 +// 
   1.268 +//     free_stringlist(keys);
   1.269 +// 
   1.270 +//     if (msg && msg->shortmsg == NULL) {
   1.271 +//         msg->shortmsg = strdup(src->shortmsg);
   1.272 +//         assert(msg->shortmsg);
   1.273 +//         if (msg->shortmsg == NULL)
   1.274 +//             goto enomem;
   1.275 +//     }
   1.276 +// 
   1.277 +//     if (msg) {
   1.278 +//         decorate_message(msg, PEP_rating_undefined, NULL);
   1.279 +//         if (src->id) {
   1.280 +//             msg->id = strdup(src->id);
   1.281 +//             assert(msg->id);
   1.282 +//             if (msg->id == NULL)
   1.283 +//                 goto enomem;
   1.284 +//         }
   1.285 +//     }
   1.286 +// 
   1.287 +//     *dst = msg;
   1.288 +//     return status;
   1.289 +// 
   1.290 +// enomem:
   1.291 +//     status = PEP_OUT_OF_MEMORY;
   1.292 +// 
   1.293 +// pep_error:
   1.294 +//     free_stringlist(keys);
   1.295 +//     free_message(msg);
   1.296 +// 
   1.297 +//     return status;
   1.298 +// }
   1.299  
   1.300  
   1.301  DYNAMIC_API PEP_STATUS encrypt_message(
   1.302 @@ -1905,101 +1876,103 @@
   1.303      return status;
   1.304  }
   1.305  
   1.306 -PEP_STATUS check_signed_message(PEP_SESSION session,
   1.307 -                                message *src,
   1.308 -                                char** signing_key_ptr
   1.309 -                            )
   1.310 -{                          
   1.311 -    if (!signing_key_ptr || !src || !session || !src->from ||
   1.312 -        !src->from->address)
   1.313 -        return PEP_ILLEGAL_VALUE;
   1.314 - 
   1.315 -    PEP_STATUS status = PEP_VERIFY_NO_KEY;
   1.316 -    signing_key_ptr = NULL;
   1.317 -    
   1.318 -    determine_encryption_format(src);
   1.319 -    if (src->enc_format != PEP_enc_none)
   1.320 -        return PEP_ILLEGAL_VALUE;
   1.321 -
   1.322 -    /* Ok, input checked, let's go */
   1.323 -    bool imported_keys = import_attached_keys(session, src, NULL);
   1.324 -
   1.325 -    // Update src->from in case we just imported a key
   1.326 -    // we would need to check signature
   1.327 -    status = _update_identity_for_incoming_message(session, src);
   1.328 -    if(status != PEP_STATUS_OK)
   1.329 -        return status;
   1.330 -    
   1.331 -    // Get detached signature, if any
   1.332 -    bloblist_t* detached_sig = NULL;
   1.333 -    char* dsig_text = NULL;
   1.334 -    size_t dsig_size = 0;
   1.335 -    status = _get_detached_signature(src, &detached_sig);
   1.336 -    if (detached_sig) {
   1.337 -        dsig_text = detached_sig->value;
   1.338 -        dsig_size = detached_sig->size;
   1.339 -    }
   1.340 -    else {
   1.341 -        // Per Volker, we don't deal with clearsigned texts here. Period.
   1.342 -        // This means that we have to implement clearsign-splitting
   1.343 -        // in parsing.
   1.344 -        return PEP_VERIFY_NO_SIGNATURE;
   1.345 -    }
   1.346 -
   1.347 -    /* Pull bodies stuck in the attachments up. */
   1.348 -    /* FIXME: Actually, this is also something  */
   1.349 -    /* that should be fixed at a higher level   */
   1.350 -    char* slong = src->longmsg;
   1.351 -    char* sform = src->longmsg_formatted;
   1.352 -    
   1.353 -    if ((!slong || slong[0] == '\0')
   1.354 -         && (!sform || sform[0] == '\0')) {
   1.355 -        status = raise_body(src);
   1.356 -    }
   1.357 -
   1.358 -    dsig_text = detached_sig->value;
   1.359 -    dsig_size = detached_sig->size;
   1.360 -    //FIXME: what if it's empty text? This is wrong. Find a better fix.
   1.361 -    bool use_longmsg_formatted = ((!src->longmsg || src->longmsg[0] == '\0') &&
   1.362 -                                  src->longmsg_formatted &&
   1.363 -                                  src->longmsg_formatted[0] != '\0'); 
   1.364 -    const char* bodytext = (use_longmsg_formatted ? src->longmsg_formatted : src->longmsg);
   1.365 -    size_t bodysize = strlen(bodytext);
   1.366 -    char* stext = NULL;
   1.367 -    size_t ssize = 0;
   1.368 -
   1.369 -    status = _get_signed_text(bodytext, bodysize, &stext, &ssize);
   1.370 -    stringlist_t *_verify_keylist = NULL;
   1.371 -
   1.372 -    if (ssize > 0 && stext) {
   1.373 -        // FIXME!!!!!!!!!!!!!!!!!!!!!
   1.374 -        status = cryptotech[PEP_crypt_OpenPGP].verify_text(session, stext,
   1.375 -                                                ssize, dsig_text, dsig_size,
   1.376 -                                                &_verify_keylist);
   1.377 -
   1.378 -    }
   1.379 -
   1.380 -    // if (status != PEP_VERIFIED && status != PEP_VERIFIED_AND_TRUSTED) {
   1.381 -    //     status = cryptotech[crypto].verify_text(session, stext,
   1.382 -    //                                             ssize, NULL, NULL,
   1.383 -    //                                             &_verify_keylist);        
   1.384 -    // }
   1.385 -    
   1.386 -    if (status == PEP_VERIFIED || status == PEP_VERIFIED_AND_TRUSTED) {
   1.387 -        // FIXME: free stext et al ??
   1.388 -        if (!_verify_keylist) // These should NEVER happen... bug if so!
   1.389 -            return PEP_UNKNOWN_ERROR;
   1.390 -        char* retfpr = _verify_keylist->value;
   1.391 -        if (!retfpr || retfpr[0] == '\0') {
   1.392 -            free_stringlist(_verify_keylist);
   1.393 -            return PEP_UNKNOWN_ERROR; // Still would be a bug...
   1.394 -        }
   1.395 -        // FIXME - check stringlist_t ownership
   1.396 -        signing_key_ptr = strdup(retfpr);
   1.397 -    }
   1.398 -
   1.399 -    return status;                              
   1.400 -}
   1.401 +// KG: Nope, we're too late in the parse to do this for
   1.402 +// unencrypted messages. 
   1.403 +// PEP_STATUS check_signed_message(PEP_SESSION session,
   1.404 +//                                 message *src,
   1.405 +//                                 char** signing_key_ptr
   1.406 +//                             )
   1.407 +// {                          
   1.408 +//     if (!signing_key_ptr || !src || !session || !src->from ||
   1.409 +//         !src->from->address)
   1.410 +//         return PEP_ILLEGAL_VALUE;
   1.411 +//  
   1.412 +//     PEP_STATUS status = PEP_VERIFY_NO_KEY;
   1.413 +//     signing_key_ptr = NULL;
   1.414 +//     
   1.415 +//     determine_encryption_format(src);
   1.416 +//     if (src->enc_format != PEP_enc_none)
   1.417 +//         return PEP_ILLEGAL_VALUE;
   1.418 +// 
   1.419 +//     /* Ok, input checked, let's go */
   1.420 +//     bool imported_keys = import_attached_keys(session, src, NULL);
   1.421 +// 
   1.422 +//     // Update src->from in case we just imported a key
   1.423 +//     // we would need to check signature
   1.424 +//     status = _update_identity_for_incoming_message(session, src);
   1.425 +//     if(status != PEP_STATUS_OK)
   1.426 +//         return status;
   1.427 +//     
   1.428 +//     // Get detached signature, if any
   1.429 +//     bloblist_t* detached_sig = NULL;
   1.430 +//     char* dsig_text = NULL;
   1.431 +//     size_t dsig_size = 0;
   1.432 +//     status = _get_detached_signature(src, &detached_sig);
   1.433 +//     if (detached_sig) {
   1.434 +//         dsig_text = detached_sig->value;
   1.435 +//         dsig_size = detached_sig->size;
   1.436 +//     }
   1.437 +//     else {
   1.438 +//         // Per Volker, we don't deal with clearsigned texts here. Period.
   1.439 +//         // This means that we have to implement clearsign-splitting
   1.440 +//         // in parsing.
   1.441 +//         return PEP_VERIFY_NO_SIGNATURE;
   1.442 +//     }
   1.443 +// 
   1.444 +//     /* Pull bodies stuck in the attachments up. */
   1.445 +//     /* FIXME: Actually, this is also something  */
   1.446 +//     /* that should be fixed at a higher level   */
   1.447 +//     char* slong = src->longmsg;
   1.448 +//     char* sform = src->longmsg_formatted;
   1.449 +//     
   1.450 +//     if ((!slong || slong[0] == '\0')
   1.451 +//          && (!sform || sform[0] == '\0')) {
   1.452 +//         status = raise_body(src);
   1.453 +//     }
   1.454 +// 
   1.455 +//     dsig_text = detached_sig->value;
   1.456 +//     dsig_size = detached_sig->size;
   1.457 +//     //FIXME: what if it's empty text? This is wrong. Find a better fix.
   1.458 +//     bool use_longmsg_formatted = ((!src->longmsg || src->longmsg[0] == '\0') &&
   1.459 +//                                   src->longmsg_formatted &&
   1.460 +//                                   src->longmsg_formatted[0] != '\0'); 
   1.461 +//     const char* bodytext = (use_longmsg_formatted ? src->longmsg_formatted : src->longmsg);
   1.462 +//     size_t bodysize = strlen(bodytext);
   1.463 +//     char* stext = NULL;
   1.464 +//     size_t ssize = 0;
   1.465 +// 
   1.466 +//     status = _get_signed_text(bodytext, bodysize, &stext, &ssize);
   1.467 +//     stringlist_t *_verify_keylist = NULL;
   1.468 +// 
   1.469 +//     if (ssize > 0 && stext) {
   1.470 +//         // FIXME!!!!!!!!!!!!!!!!!!!!!
   1.471 +//         status = cryptotech[PEP_crypt_OpenPGP].verify_text(session, stext,
   1.472 +//                                                 ssize, dsig_text, dsig_size,
   1.473 +//                                                 &_verify_keylist);
   1.474 +// 
   1.475 +//     }
   1.476 +// 
   1.477 +//     // if (status != PEP_VERIFIED && status != PEP_VERIFIED_AND_TRUSTED) {
   1.478 +//     //     status = cryptotech[crypto].verify_text(session, stext,
   1.479 +//     //                                             ssize, NULL, NULL,
   1.480 +//     //                                             &_verify_keylist);        
   1.481 +//     // }
   1.482 +//     
   1.483 +//     if (status == PEP_VERIFIED || status == PEP_VERIFIED_AND_TRUSTED) {
   1.484 +//         // FIXME: free stext et al ??
   1.485 +//         if (!_verify_keylist) // These should NEVER happen... bug if so!
   1.486 +//             return PEP_UNKNOWN_ERROR;
   1.487 +//         char* retfpr = _verify_keylist->value;
   1.488 +//         if (!retfpr || retfpr[0] == '\0') {
   1.489 +//             free_stringlist(_verify_keylist);
   1.490 +//             return PEP_UNKNOWN_ERROR; // Still would be a bug...
   1.491 +//         }
   1.492 +//         // FIXME - check stringlist_t ownership
   1.493 +//         signing_key_ptr = strdup(retfpr);
   1.494 +//     }
   1.495 +// 
   1.496 +//     return status;                              
   1.497 +// }
   1.498  
   1.499  
   1.500  DYNAMIC_API PEP_STATUS _decrypt_message(
     2.1 --- a/src/message_api.h	Fri Mar 24 15:47:07 2017 +0100
     2.2 +++ b/src/message_api.h	Sat Mar 25 11:27:35 2017 +0100
     2.3 @@ -13,6 +13,8 @@
     2.4  #endif
     2.5  
     2.6  
     2.7 +/* BEGIN INTERNAL FUNCTIONS - NOT FOR EXPORT */
     2.8 +
     2.9  bool import_attached_keys(
    2.10          PEP_SESSION session, 
    2.11          const message *msg,
    2.12 @@ -20,6 +22,8 @@
    2.13      );
    2.14  void attach_own_key(PEP_SESSION session, message *msg);
    2.15  
    2.16 +// detached sig text is returned in signature, along
    2.17 +// with its size in sig_size
    2.18  PEP_STATUS sign_blob(PEP_SESSION session,
    2.19                       pEp_identity* signer_id,
    2.20                       bloblist_t* blob,
    2.21 @@ -31,32 +35,44 @@
    2.22                         char* signature,
    2.23                         size_t sig_size);
    2.24  
    2.25 -PEP_STATUS sign_message(PEP_SESSION session,
    2.26 -                        message *src,
    2.27 -                        message **dst);
    2.28 -
    2.29 +// *signer_fpr is the signing key fpr, if verified
    2.30  PEP_STATUS verify_beacon_message(PEP_SESSION session,
    2.31                                   message* beacon_msg,
    2.32                                   char** signer_fpr);
    2.33  
    2.34 +// beacon_msg is an in-out param - it must at least
    2.35 +// have beacon_msg->from filled in so we can grab the key
    2.36 +// with which to sign it.
    2.37  PEP_STATUS prepare_beacon_message(PEP_SESSION session,
    2.38                                    char* beacon_blob,
    2.39                                    size_t beacon_size,
    2.40                                    message* beacon_msg); 
    2.41 -            
    2.42 -/* checks if a message is correctly signend
    2.43 -with a key that has a UID with the email address of message.from. If
    2.44 -result is PEP_VERIFIED, it additionally delivers fpr of the signature
    2.45 -key. The function has to import attached keys first before doing the
    2.46 -check.  It must not handle encrypted messages but give an error value
    2.47 -for them. */
    2.48 -PEP_STATUS check_signed_message(PEP_SESSION session,
    2.49 -                                message *src,
    2.50 -                                char** signing_key_ptr);
    2.51 +
    2.52 +// Left in for commit, but these don't work the way we
    2.53 +// would intend, and the 2nd is useless because the parse
    2.54 +// has already removed necessary information for signed,
    2.55 +// not encrypted texts. If we want it, we have to
    2.56 +// do some significant reworking. -- KB
    2.57 +//
    2.58 +// PEP_STATUS sign_message(PEP_SESSION session,
    2.59 +//                       message *src,
    2.60 +//                       message **dst);
    2.61 +//             
    2.62 +// /* checks if a message is correctly signend
    2.63 +// with a key that has a UID with the email address of message.from. If
    2.64 +// result is PEP_VERIFIED, it additionally delivers fpr of the signature
    2.65 +// key. The function has to import attached keys first before doing the
    2.66 +// check.  It must not handle encrypted messages but give an error value
    2.67 +// for them. */
    2.68 +// PEP_STATUS check_signed_message(PEP_SESSION session,
    2.69 +//                                 message *src,
    2.70 +//                                 char** signing_key_ptr);
    2.71  
    2.72  PEP_cryptotech determine_encryption_format(message *msg);
    2.73  void add_opt_field(message *msg, const char *name, const char *value);
    2.74  
    2.75 +/* END INTERNAL FUNCTIONS - NOT FOR EXPORT */
    2.76 +
    2.77  typedef enum _PEP_encrypt_flags {
    2.78      // "default" means whatever the default behaviour for the function is.
    2.79      PEP_encrypt_flag_default = 0x0,