ENGINE-423: normal tests pass. Now to test reencrypt functionality. ENGINE-423
authorKrista Bennett <krista@pep-project.org>
Thu, 19 Apr 2018 16:03:44 +0200
branchENGINE-423
changeset 26155cd3625e0d91
parent 2614 3ea0f7f89ac3
child 2616 13e9725995f2
ENGINE-423: normal tests pass. Now to test reencrypt functionality.
src/keymanagement.h
src/message.c
src/message.h
src/message_api.c
src/pEpEngine.h
test/apple_mail_test.cc
test/blacklist_accept_new_key_test.cc
test/decrypt_attach_private_key_trusted_test.cc
test/decrypt_attach_private_key_untrusted_test.cc
test/encrypt_for_identity_test.cc
test/external_revoke_test.cc
test/lars_test_do_not_run_outside_of_test_environment.cc
test/least_color_group_test.cc
test/least_common_denom_color_test.cc
test/message_2.0_test.cc
test/message_api_test.cc
test/pEp_subject_received_test.cc
     1.1 --- a/src/keymanagement.h	Thu Apr 19 09:38:52 2018 +0200
     1.2 +++ b/src/keymanagement.h	Thu Apr 19 16:03:44 2018 +0200
     1.3 @@ -363,6 +363,11 @@
     1.4  PEP_STATUS add_mistrusted_key(PEP_SESSION session, const char* fpr);
     1.5  PEP_STATUS delete_mistrusted_key(PEP_SESSION session, const char* fpr);
     1.6  PEP_STATUS is_mistrusted_key(PEP_SESSION session, const char* fpr, bool* mistrusted);
     1.7 +PEP_STATUS get_user_default_key(PEP_SESSION session, const char* user_id,
     1.8 +                                char** default_key);
     1.9 +
    1.10 +
    1.11 +
    1.12  
    1.13  // Only call on retrieval of previously stored identity!
    1.14  // Also, we presume that if the stored_identity was sent in
     2.1 --- a/src/message.c	Thu Apr 19 09:38:52 2018 +0200
     2.2 +++ b/src/message.c	Thu Apr 19 16:03:44 2018 +0200
     2.3 @@ -201,6 +201,81 @@
     2.4      return NULL;
     2.5  }
     2.6  
     2.7 +DYNAMIC_API void message_transfer(message* dst, message *src)
     2.8 +{
     2.9 +    assert(dst);
    2.10 +    assert(src);
    2.11 +
    2.12 +    dst->dir = src->dir;
    2.13 +    dst->rawmsg_ref = src->rawmsg_ref;
    2.14 +    dst->rawmsg_size = src->rawmsg_size;
    2.15 +    dst->refering_msg_ref = src->refering_msg_ref;
    2.16 +    dst->enc_format = src->enc_format;
    2.17 +
    2.18 +    /* Strings */
    2.19 +    free(dst->id);
    2.20 +    free(dst->shortmsg);
    2.21 +    free(dst->longmsg);
    2.22 +    free(dst->longmsg_formatted);
    2.23 +    free(dst->comments);
    2.24 +    dst->id = src->id;
    2.25 +    dst->shortmsg = src->shortmsg;
    2.26 +    dst->longmsg = src->longmsg;
    2.27 +    dst->longmsg_formatted = src->longmsg_formatted;
    2.28 +    dst->comments = src->comments;    
    2.29 +    src->id = src->shortmsg = src->longmsg = src->longmsg_formatted = NULL;
    2.30 +    src->comments = NULL;
    2.31 +    
    2.32 +    /* bloblists */
    2.33 +    free_bloblist(dst->attachments);
    2.34 +    dst->attachments = src->attachments;
    2.35 +    src->attachments = NULL;
    2.36 +    
    2.37 +    /* timestamps */
    2.38 +    free_timestamp(dst->sent);
    2.39 +    free_timestamp(dst->recv);
    2.40 +    dst->sent = src->sent;
    2.41 +    dst->recv = src->recv;
    2.42 +    src->sent = src->recv = NULL;
    2.43 +    
    2.44 +    /* identities */
    2.45 +    free_identity(dst->from);
    2.46 +    free_identity(dst->recv_by);
    2.47 +    dst->from = src->from;
    2.48 +    dst->recv_by = src->recv_by;
    2.49 +    src->from = src->recv_by = NULL;
    2.50 +    
    2.51 +    /* identity lists */
    2.52 +    free_identity_list(dst->to);
    2.53 +    free_identity_list(dst->cc);
    2.54 +    free_identity_list(dst->bcc);
    2.55 +    free_identity_list(dst->reply_to);
    2.56 +    dst->to = src->to;
    2.57 +    dst->cc = src->cc;
    2.58 +    dst->bcc = src->bcc;
    2.59 +    dst->reply_to = src->reply_to;
    2.60 +    src->to = src->cc = src->bcc = src->reply_to = NULL;
    2.61 +
    2.62 +    /* stringlists */
    2.63 +    free_stringlist(dst->references);
    2.64 +    free_stringlist(dst->keywords);
    2.65 +    free_stringlist(dst->in_reply_to);
    2.66 +    dst->references = src->references;
    2.67 +    dst->keywords = src->keywords;
    2.68 +    dst->in_reply_to = src->in_reply_to;
    2.69 +    src->references = src->keywords = src->in_reply_to = NULL;
    2.70 +
    2.71 +    /* message ref list */
    2.72 +    free_message_ref_list(dst->refered_by);
    2.73 +    dst->refered_by = src->refered_by;
    2.74 +    src->refered_by = NULL;
    2.75 +    
    2.76 +    /* stringpair lists */
    2.77 +    free_stringpair_list(dst->opt_fields);
    2.78 +    dst->opt_fields = src->opt_fields;
    2.79 +    src->opt_fields = NULL;
    2.80 +}
    2.81 +
    2.82  DYNAMIC_API message_ref_list *new_message_ref_list(message *msg)
    2.83  {
    2.84      message_ref_list *msg_list = calloc(1, sizeof(message_ref_list));
    2.85 @@ -266,4 +341,3 @@
    2.86          return message_ref_list_add(msg_list->next, msg);
    2.87      }
    2.88  }
    2.89 -
     3.1 --- a/src/message.h	Thu Apr 19 09:38:52 2018 +0200
     3.2 +++ b/src/message.h	Thu Apr 19 16:03:44 2018 +0200
     3.3 @@ -114,6 +114,20 @@
     3.4  
     3.5  DYNAMIC_API message * message_dup(const message *msg);
     3.6  
     3.7 +// message_transfer - assign ownership of all fields of the src message to
     3.8 +//                    the dst message object passed in. Free respective memory
     3.9 +//                    in the dst message, and reinitialise and pointers in 
    3.10 +//                    the src message to NULL so that it can be freed properly
    3.11 +//                    by its owner.
    3.12 +//  parameters:
    3.13 +//      dst (inout)        message to clobber and reassign values to
    3.14 +//      src (inout)        message whose values will be transfered to dst
    3.15 +//  NOTA BENE:
    3.16 +//      not owned pointees (msg->rawmsg_ref and msg->refering_msg_ref) are shared!
    3.17 +//      these are simply transferred.
    3.18 +DYNAMIC_API void message_transfer(message* dst, message *src);
    3.19 +
    3.20 +
    3.21  // new_message_ref_list() - allocate new message reference list
    3.22  //
    3.23  //  parameters:
     4.1 --- a/src/message_api.c	Thu Apr 19 09:38:52 2018 +0200
     4.2 +++ b/src/message_api.c	Thu Apr 19 16:03:44 2018 +0200
     4.3 @@ -2041,7 +2041,7 @@
     4.4          if (status != PEP_STATUS_OK)
     4.5              goto pep_error;
     4.6      }
     4.7 -    else if (!target_fpr)
     4.8 +    else if (!target_id->fpr)
     4.9          return PEP_ILLEGAL_VALUE;
    4.10      
    4.11      *dst = NULL;
    4.12 @@ -2892,7 +2892,7 @@
    4.13      PEP_STATUS status = key_revoked(session, fpr, &reject);
    4.14  
    4.15      if (!reject) {
    4.16 -        status = key_expired(session, fpr, &reject);
    4.17 +        status = key_expired(session, fpr, time(NULL), &reject);
    4.18          if (reject) {
    4.19              timestamp *ts = new_timestamp(time(NULL) + KEY_EXPIRE_DELTA);
    4.20              status = renew_key(session, fpr, ts);
    4.21 @@ -2910,12 +2910,11 @@
    4.22          return NULL;
    4.23          
    4.24      stringlist_t* kl_curr = keylist;
    4.25 -    char* retval = NULL;
    4.26      while (kl_curr) {
    4.27          char* fpr = kl_curr->value;
    4.28          
    4.29 -        if (is_own_trusted_private_fpr(fpr)) { 
    4.30 -            if (!reject_fpr(fpr))
    4.31 +        if (is_trusted_own_priv_fpr(session, own_id, fpr)) { 
    4.32 +            if (!reject_fpr(session, fpr))
    4.33                  return strdup(fpr);
    4.34          }
    4.35              
    4.36 @@ -2925,12 +2924,12 @@
    4.37      char* target_own_fpr = NULL;
    4.38      
    4.39      // Last shot...
    4.40 -    status = get_user_default_key(session, own_id, 
    4.41 -                                  &target_own_fpr);
    4.42 +    PEP_STATUS status = get_user_default_key(session, own_id, 
    4.43 +                                             &target_own_fpr);
    4.44  
    4.45      if (status == PEP_STATUS_OK && !EMPTYSTR(target_own_fpr)) {
    4.46 -        if (is_own_trusted_private_fpr(target_own_fpr)) { 
    4.47 -            if (!reject_fpr(target_own_fpr))
    4.48 +        if (is_trusted_own_priv_fpr(session, own_id, target_own_fpr)) { 
    4.49 +            if (!reject_fpr(session, target_own_fpr))
    4.50                  return target_own_fpr;
    4.51          }
    4.52      }
    4.53 @@ -2976,7 +2975,7 @@
    4.54      bool is_pep_msg = is_a_pEpmessage(src);
    4.55  
    4.56      // Grab input flags
    4.57 -    bool reencrypt = (*flags & PEP_decrypt_flag_untrusted_server > 0);
    4.58 +    bool reencrypt = ((*flags & PEP_decrypt_flag_untrusted_server) > 0);
    4.59      
    4.60      // We own this pointer, and we take control of *keylist if reencrypting.
    4.61      stringlist_t* extra = NULL;
    4.62 @@ -3326,6 +3325,7 @@
    4.63  
    4.64      *dst = msg;
    4.65      *keylist = _keylist;
    4.66 +    message* reencrypt_msg;
    4.67  
    4.68      if (reencrypt) {
    4.69          if (decrypt_status == PEP_DECRYPTED || decrypt_status == PEP_DECRYPTED_AND_VERIFIED) {
    4.70 @@ -3337,28 +3337,30 @@
    4.71                                                                       own_id,
    4.72                                                                       _keylist);
    4.73                  if (target_own_fpr) {
    4.74 -                    pEp_identity* target_id = new_identity(NULL, own_id, 
    4.75 -                                                           target_own_fpr, NULL);
    4.76 +                    pEp_identity* target_id = new_identity(NULL, target_own_fpr, 
    4.77 +                                                           own_id, NULL);
    4.78                      if (target_id) {
    4.79                          *dst = NULL;
    4.80                          reencrypt_status = encrypt_message_for_self(session, target_id, msg,
    4.81 -                                                                    extra, dst, PEP_enc_PGP_MIME,
    4.82 +                                                                    extra, &reencrypt_msg, PEP_enc_PGP_MIME,
    4.83                                                                      0);
    4.84                          if (reencrypt_status != PEP_STATUS_OK)
    4.85                              reencrypt_status = PEP_CANNOT_REENCRYPT;
    4.86 -                            
    4.87 +                        
    4.88                          free_identity(target_id);
    4.89                      }
    4.90                      free(target_own_fpr);
    4.91                  }     
    4.92                  free(own_id);
    4.93              }
    4.94 -        }
    4.95 -        free_stringlist(extra); // This was an input variable for us. Keylist is overwritten above.
    4.96 -        if (reencrypt_status == PEP_CANNOT_REENCRYPT)
    4.97 -            decrypt_status = reencrypt_status;
    4.98 -        else {
    4.99 -            // Copy msg into src
   4.100 +            free_stringlist(extra); // This was an input variable for us. Keylist is overwritten above.
   4.101 +            
   4.102 +            if (reencrypt_status != PEP_CANNOT_REENCRYPT && reencrypt_msg) {
   4.103 +                message_transfer(src, reencrypt_msg);
   4.104 +                free_message(reencrypt_msg);
   4.105 +            }
   4.106 +            else
   4.107 +                decrypt_status = PEP_CANNOT_REENCRYPT;
   4.108          }
   4.109      }
   4.110          
     5.1 --- a/src/pEpEngine.h	Thu Apr 19 09:38:52 2018 +0200
     5.2 +++ b/src/pEpEngine.h	Thu Apr 19 16:03:44 2018 +0200
     5.3 @@ -72,6 +72,7 @@
     5.4      PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH            = 0x0406,
     5.5      PEP_VERIFY_NO_KEY                               = 0x0407,
     5.6      PEP_VERIFIED_AND_TRUSTED                        = 0x0408,
     5.7 +    PEP_CANNOT_REENCRYPT                            = 0x0409,
     5.8      PEP_CANNOT_DECRYPT_UNKNOWN                      = 0x04ff,
     5.9  
    5.10      PEP_TRUSTWORD_NOT_FOUND                         = 0x0501,
     6.1 --- a/test/apple_mail_test.cc	Thu Apr 19 09:38:52 2018 +0200
     6.2 +++ b/test/apple_mail_test.cc	Thu Apr 19 16:03:44 2018 +0200
     6.3 @@ -50,7 +50,7 @@
     6.4      message* final_ptr = nullptr;
     6.5      stringlist_t* keylist = nullptr;
     6.6      PEP_rating rating;
     6.7 -    PEP_decrypt_flags_t flags;
     6.8 +    PEP_decrypt_flags_t flags = 0;
     6.9      
    6.10      status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
    6.11      assert(status == PEP_STATUS_OK);
    6.12 @@ -80,6 +80,7 @@
    6.13      final_ptr = nullptr;
    6.14      keylist = nullptr;
    6.15      rating = PEP_rating_unreliable;
    6.16 +    flags = 0;
    6.17      
    6.18      const char* mailfile2 = "test_mails/apple_mail_TC_html_signed_encrypted.eml";
    6.19      const string mailtext2 = slurp(mailfile2);
     7.1 --- a/test/blacklist_accept_new_key_test.cc	Thu Apr 19 09:38:52 2018 +0200
     7.2 +++ b/test/blacklist_accept_new_key_test.cc	Thu Apr 19 16:03:44 2018 +0200
     7.3 @@ -76,7 +76,7 @@
     7.4      message* dest_msg = nullptr;
     7.5      stringlist_t* keylist = nullptr;
     7.6      PEP_rating rating;
     7.7 -    PEP_decrypt_flags_t flags;
     7.8 +    PEP_decrypt_flags_t flags = 0;
     7.9      
    7.10      status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
    7.11      assert(status == PEP_STATUS_OK);
     8.1 --- a/test/decrypt_attach_private_key_trusted_test.cc	Thu Apr 19 09:38:52 2018 +0200
     8.2 +++ b/test/decrypt_attach_private_key_trusted_test.cc	Thu Apr 19 16:03:44 2018 +0200
     8.3 @@ -102,7 +102,7 @@
     8.4      char* decrypted_text = NULL;
     8.5      stringlist_t* keylist_used = NULL;
     8.6      PEP_rating rating;
     8.7 -    PEP_decrypt_flags_t flags;
     8.8 +    PEP_decrypt_flags_t flags = 0;
     8.9      
    8.10      cout << "Trusting personal key for " << same_addr_same_uid->user_id << " and " << same_addr_same_uid->fpr << endl;
    8.11      status = trust_personal_key(session, same_addr_same_uid);
    8.12 @@ -116,6 +116,7 @@
    8.13      
    8.14      assert(same_addr_same_uid->comm_type == PEP_ct_pEp);
    8.15      
    8.16 +    flags = 0;
    8.17      status = MIME_decrypt_message(session, encoded_text.c_str(), 
    8.18                                    encoded_text.size(), &decrypted_text, 
    8.19                                    &keylist_used, &rating, &flags);
    8.20 @@ -123,6 +124,7 @@
    8.21      status = get_trust(session, same_addr_same_uid);
    8.22      assert(same_addr_same_uid->comm_type == PEP_ct_pEp);
    8.23      
    8.24 +    flags = 0;
    8.25      status = MIME_decrypt_message(session, encoded_text.c_str(), 
    8.26                                    encoded_text.size(), &decrypted_text, 
    8.27                                    &keylist_used, &rating, &flags);
     9.1 --- a/test/decrypt_attach_private_key_untrusted_test.cc	Thu Apr 19 09:38:52 2018 +0200
     9.2 +++ b/test/decrypt_attach_private_key_untrusted_test.cc	Thu Apr 19 16:03:44 2018 +0200
     9.3 @@ -103,6 +103,7 @@
     9.4      
     9.5      assert((same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed);
     9.6      
     9.7 +    flags = 0;
     9.8      status = MIME_decrypt_message(session, encoded_text.c_str(), 
     9.9                                    encoded_text.size(), &decrypted_text, 
    9.10                                    &keylist_used, &rating, &flags);
    10.1 --- a/test/encrypt_for_identity_test.cc	Thu Apr 19 09:38:52 2018 +0200
    10.2 +++ b/test/encrypt_for_identity_test.cc	Thu Apr 19 16:03:44 2018 +0200
    10.3 @@ -107,6 +107,7 @@
    10.4      PEP_rating rating;
    10.5      PEP_decrypt_flags_t flags;
    10.6  
    10.7 +    flags = 0;
    10.8      status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
    10.9      assert(decrypted_msg);
   10.10      assert(keylist_used);
   10.11 @@ -152,6 +153,7 @@
   10.12      assert(encrypted_msg);
   10.13      cout << "message encrypted.\n";
   10.14      
   10.15 +    flags = 0;
   10.16      status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
   10.17      assert(decrypted_msg);
   10.18      assert(keylist_used);
   10.19 @@ -246,6 +248,7 @@
   10.20      PEP_decrypt_flags_t mimeflags;
   10.21      PEP_rating mimerating;
   10.22  
   10.23 +    mimeflags = 0;
   10.24      status = MIME_decrypt_message(session,
   10.25                                    encrypted_mimetext,
   10.26                                    strlen(encrypted_mimetext),
    11.1 --- a/test/external_revoke_test.cc	Thu Apr 19 09:38:52 2018 +0200
    11.2 +++ b/test/external_revoke_test.cc	Thu Apr 19 16:03:44 2018 +0200
    11.3 @@ -125,6 +125,7 @@
    11.4      cout << "1b. Decrypt message that was encrypted for trusted partner." << endl;
    11.5      cout << "---------------------------------------------------------" << endl << endl;
    11.6  
    11.7 +    flags = 0;
    11.8      cout << "Decrypting message." << endl;
    11.9      status = decrypt_message(session, encrypted_outgoing_msg, &outgoing_msg, &keylist, &rating, &flags);
   11.10      cout << "Decrypted message with status " << tl_status_string(status) << endl;
   11.11 @@ -260,6 +261,7 @@
   11.12      cout << "---------------------------------------------------------" << endl << endl;
   11.13  
   11.14  
   11.15 +    flags = 0;
   11.16      status = decrypt_message(session, encrypted_outgoing_msg, &decrypted_msg, &keylist, &rating, &flags);
   11.17      cout << "Decryption returns with status " << tl_status_string(status) << endl;
   11.18      assert(status == PEP_STATUS_OK);
    12.1 --- a/test/lars_test_do_not_run_outside_of_test_environment.cc	Thu Apr 19 09:38:52 2018 +0200
    12.2 +++ b/test/lars_test_do_not_run_outside_of_test_environment.cc	Thu Apr 19 16:03:44 2018 +0200
    12.3 @@ -142,6 +142,7 @@
    12.4  	PEP_rating rating;
    12.5  	PEP_decrypt_flags_t dec_flags;
    12.6  	
    12.7 +        dec_flags = 0;
    12.8  	PEP_STATUS status2 = MIME_decrypt_message(session, mimetext.c_str(), mimetext.length(),
    12.9  		&plaintext, &keys_used, &rating, &dec_flags);
   12.10  	
    13.1 --- a/test/least_color_group_test.cc	Thu Apr 19 09:38:52 2018 +0200
    13.2 +++ b/test/least_color_group_test.cc	Thu Apr 19 16:03:44 2018 +0200
    13.3 @@ -68,6 +68,7 @@
    13.4      assert(status == PEP_STATUS_OK);
    13.5      assert(msg_ptr);
    13.6      final_ptr = msg_ptr;
    13.7 +    flags = 0;
    13.8      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
    13.9      final_ptr = dest_msg ? dest_msg : msg_ptr;
   13.10    
    14.1 --- a/test/least_common_denom_color_test.cc	Thu Apr 19 09:38:52 2018 +0200
    14.2 +++ b/test/least_common_denom_color_test.cc	Thu Apr 19 16:03:44 2018 +0200
    14.3 @@ -66,6 +66,7 @@
    14.4      assert(status == PEP_STATUS_OK);
    14.5      assert(msg_ptr);
    14.6  
    14.7 +    flags = 0;
    14.8      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
    14.9      assert(status == PEP_STATUS_OK);
   14.10      assert(dest_msg);
   14.11 @@ -113,6 +114,7 @@
   14.12      status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr);
   14.13      assert(status == PEP_STATUS_OK);
   14.14      assert(msg_ptr);
   14.15 +    flags = 0;
   14.16      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
   14.17    
   14.18      cout << "shortmsg: " << dest_msg->shortmsg << endl << endl;
    15.1 --- a/test/message_2.0_test.cc	Thu Apr 19 09:38:52 2018 +0200
    15.2 +++ b/test/message_2.0_test.cc	Thu Apr 19 16:03:44 2018 +0200
    15.3 @@ -134,6 +134,7 @@
    15.4      // 
    15.5      stringpair_t* autoconsume = new_stringpair("pEp-auto-consume", "yes");
    15.6      stringpair_list_add(encrypted_msg->opt_fields, autoconsume);
    15.7 +    flags = 0;
    15.8      status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
    15.9      assert(decrypted_msg);
   15.10      assert(keylist_used);
    16.1 --- a/test/message_api_test.cc	Thu Apr 19 09:38:52 2018 +0200
    16.2 +++ b/test/message_api_test.cc	Thu Apr 19 16:03:44 2018 +0200
    16.3 @@ -93,6 +93,7 @@
    16.4      PEP_rating rating;
    16.5      PEP_decrypt_flags_t flags;
    16.6      
    16.7 +    flags = 0;
    16.8      PEP_STATUS status4 = decrypt_message(session, enc_msg2, &msg4, &keylist4, &rating, &flags);
    16.9      assert(status4 == PEP_STATUS_OK);
   16.10      assert(msg4);
   16.11 @@ -136,6 +137,7 @@
   16.12      stringlist_t *keylist5 = nullptr;
   16.13      PEP_rating rating2;
   16.14      PEP_decrypt_flags_t flags2;
   16.15 +    flags2 = 0;
   16.16      PEP_STATUS status6 = decrypt_message(session, msg5, &msg6, &keylist5, &rating2, &flags2);
   16.17      assert(status6 == PEP_DECRYPT_NO_KEY);
   16.18      assert(msg6 == NULL);
   16.19 @@ -177,6 +179,7 @@
   16.20      PEP_decrypt_flags_t dec_flags;
   16.21      stringlist_t* keys_used;
   16.22      
   16.23 +    dec_flags = 0;
   16.24      PEP_STATUS status8 = MIME_decrypt_message(session, text5.c_str(), text5.length(), &dec_msg, &keys_used, &rating, &dec_flags);
   16.25      assert(status8 == PEP_STATUS_OK);
   16.26      
    17.1 --- a/test/pEp_subject_received_test.cc	Thu Apr 19 09:38:52 2018 +0200
    17.2 +++ b/test/pEp_subject_received_test.cc	Thu Apr 19 16:03:44 2018 +0200
    17.3 @@ -61,6 +61,7 @@
    17.4      assert(status == PEP_STATUS_OK);
    17.5      assert(msg_ptr);
    17.6      final_ptr = msg_ptr;
    17.7 +    flags = 0;
    17.8      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
    17.9      final_ptr = dest_msg ? dest_msg : msg_ptr;
   17.10    
   17.11 @@ -93,6 +94,7 @@
   17.12      assert(status == PEP_STATUS_OK);
   17.13      assert(msg_ptr);
   17.14      final_ptr = msg_ptr;
   17.15 +    flags = 0;
   17.16      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
   17.17      final_ptr = dest_msg ? dest_msg : msg_ptr;
   17.18    
   17.19 @@ -125,6 +127,7 @@
   17.20      assert(status == PEP_STATUS_OK);
   17.21      assert(msg_ptr);
   17.22      final_ptr = msg_ptr;
   17.23 +    flags = 0;
   17.24      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
   17.25      final_ptr = dest_msg ? dest_msg : msg_ptr;
   17.26    
   17.27 @@ -157,6 +160,7 @@
   17.28      assert(status == PEP_STATUS_OK);
   17.29      assert(msg_ptr);
   17.30      final_ptr = msg_ptr;
   17.31 +    flags = 0;
   17.32      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
   17.33      final_ptr = dest_msg ? dest_msg : msg_ptr;
   17.34    
   17.35 @@ -190,6 +194,7 @@
   17.36      assert(status == PEP_STATUS_OK);
   17.37      assert(msg_ptr);
   17.38      final_ptr = msg_ptr;
   17.39 +    flags = 0;
   17.40      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
   17.41      final_ptr = dest_msg ? dest_msg : msg_ptr;
   17.42    
   17.43 @@ -222,6 +227,7 @@
   17.44      assert(status == PEP_STATUS_OK);
   17.45      assert(msg_ptr);
   17.46      final_ptr = msg_ptr;
   17.47 +    flags = 0;
   17.48      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
   17.49      final_ptr = dest_msg ? dest_msg : msg_ptr;
   17.50    
   17.51 @@ -255,6 +261,7 @@
   17.52      assert(status == PEP_STATUS_OK);
   17.53      assert(msg_ptr);
   17.54      final_ptr = msg_ptr;
   17.55 +    flags = 0;
   17.56      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
   17.57      final_ptr = dest_msg ? dest_msg : msg_ptr;
   17.58    
   17.59 @@ -287,6 +294,7 @@
   17.60      assert(status == PEP_STATUS_OK);
   17.61      assert(msg_ptr);
   17.62      final_ptr = msg_ptr;
   17.63 +    flags = 0;
   17.64      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
   17.65      final_ptr = dest_msg ? dest_msg : msg_ptr;
   17.66    
   17.67 @@ -319,6 +327,7 @@
   17.68      assert(status == PEP_STATUS_OK);
   17.69      assert(msg_ptr);
   17.70      final_ptr = msg_ptr;
   17.71 +    flags = 0;
   17.72      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
   17.73      final_ptr = dest_msg ? dest_msg : msg_ptr;
   17.74    
   17.75 @@ -351,6 +360,7 @@
   17.76      assert(status == PEP_STATUS_OK);
   17.77      assert(msg_ptr);
   17.78      final_ptr = msg_ptr;
   17.79 +    flags = 0;
   17.80      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
   17.81      final_ptr = dest_msg ? dest_msg : msg_ptr;
   17.82    
   17.83 @@ -384,6 +394,7 @@
   17.84      assert(status == PEP_STATUS_OK);
   17.85      assert(msg_ptr);
   17.86      final_ptr = msg_ptr;
   17.87 +    flags = 0;
   17.88      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
   17.89      final_ptr = dest_msg ? dest_msg : msg_ptr;
   17.90    
   17.91 @@ -417,6 +428,7 @@
   17.92      assert(status == PEP_STATUS_OK);
   17.93      assert(msg_ptr);
   17.94      final_ptr = msg_ptr;
   17.95 +    flags = 0;
   17.96      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
   17.97      final_ptr = dest_msg ? dest_msg : msg_ptr;
   17.98    
   17.99 @@ -449,6 +461,7 @@
  17.100      assert(status == PEP_STATUS_OK);
  17.101      assert(msg_ptr);
  17.102      final_ptr = msg_ptr;
  17.103 +    flags = 0;
  17.104      status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
  17.105      final_ptr = dest_msg ? dest_msg : msg_ptr;
  17.106