Browse Source

un-revert ENGINE-959

after-incompatible-change-in-ENGINE-959
Luca Saiu 7 months ago
parent
commit
a04183a5f4
38 changed files with 314 additions and 332 deletions
  1. +1
    -1
      src/keymanagement.c
  2. +4
    -0
      src/message.c
  3. +1
    -0
      src/message.h
  4. +49
    -13
      src/message_api.c
  5. +34
    -39
      src/message_api.h
  6. +34
    -0
      src/pEpEngine.h
  7. +4
    -5
      test/src/AppleMailTest.cc
  8. +1
    -2
      test/src/AsciiBinaryAtt998Test.cc
  9. +8
    -8
      test/src/CheckRenewedExpiredKeyTrustStatusTest.cc
  10. +2
    -3
      test/src/DecryptAttachPrivateKeyTrustedTest.cc
  11. +1
    -2
      test/src/DecryptAttachPrivateKeyUntrustedTest.cc
  12. +2
    -4
      test/src/ElevatedAttachmentsTest.cc
  13. +10
    -8
      test/src/EncryptForIdentityTest.cc
  14. +7
    -7
      test/src/Engine463Test.cc
  15. +1
    -2
      test/src/Engine514Test.cc
  16. +1
    -2
      test/src/Engine619Test.cc
  17. +1
    -2
      test/src/Engine655Test.cc
  18. +1
    -2
      test/src/Engine704Test.cc
  19. +4
    -3
      test/src/ExternalRevokeTest.cc
  20. +34
    -59
      test/src/GroupEncryptionTest.cc
  21. +3
    -3
      test/src/HeaderKeyImportTest.cc
  22. +18
    -36
      test/src/KeyAttachmentTest.cc
  23. +16
    -26
      test/src/KeyResetMessageTest.cc
  24. +2
    -2
      test/src/LeastColorGroupTest.cc
  25. +4
    -3
      test/src/LeastCommonDenomColorTest.cc
  26. +2
    -4
      test/src/MessageNullFromTest.cc
  27. +2
    -2
      test/src/MessageTwoPointOhTest.cc
  28. +2
    -4
      test/src/NoOwnIdentWritesOnDecryptTest.cc
  29. +5
    -5
      test/src/OldMessageApiTest.cc
  30. +6
    -12
      test/src/PassphraseTest.cc
  31. +13
    -26
      test/src/PepSubjectReceivedTest.cc
  32. +6
    -4
      test/src/ReceiverRatingTest.cc
  33. +24
    -33
      test/src/ReencryptPlusExtraKeysTest.cc
  34. +1
    -2
      test/src/SenderFPRTest.cc
  35. +6
    -2
      test/src/TestUtilities.cc
  36. +1
    -2
      test/src/URIAddressTest.cc
  37. +1
    -2
      test/src/UnencryptedPepMailTest.cc
  38. +2
    -2
      test/src/VerifyTest.cc

+ 1
- 1
src/keymanagement.c View File

@ -1020,7 +1020,7 @@ PEP_STATUS _myself(PEP_SESSION session,
// this leads to crashes otherwise
if (!(identity->user_id && identity->user_id[0])) {
if (EMPTYSTR(identity->user_id)) {
free(identity->user_id);
identity->user_id = strdup(PEP_OWN_USERID);
assert(identity->user_id);


+ 4
- 0
src/message.c View File

@ -197,6 +197,8 @@ DYNAMIC_API message * message_dup(const message *src)
msg->enc_format = src->enc_format;
msg->rating = src->rating;
return msg;
enomem:
@ -209,11 +211,13 @@ DYNAMIC_API void message_transfer(message* dst, message *src)
assert(dst);
assert(src);
/* Scalars */
dst->dir = src->dir;
dst->rawmsg_ref = src->rawmsg_ref;
dst->rawmsg_size = src->rawmsg_size;
dst->refering_msg_ref = src->refering_msg_ref;
dst->enc_format = src->enc_format;
dst->rating = src->rating;
/* Strings */
free(dst->id);


+ 1
- 0
src/message.h View File

@ -87,6 +87,7 @@ typedef struct _message {
char* _sender_fpr; // INTERNAL USE ONLY - fingerprint of
// sending signer.
// (read_only to the outside)
PEP_rating rating; // message rating
} message;
/**


+ 49
- 13
src/message_api.c View File

@ -24,6 +24,8 @@
#include "group.h"
#include "group_internal.h"
#include "status_to_string.h"
#include <assert.h>
#include <string.h>
#include <stdlib.h>
@ -108,6 +110,8 @@ static char * keylist_to_string(const stringlist_t *keylist)
static const char * rating_to_string(PEP_rating rating)
{
switch (rating) {
case PEP_rating_undefined:
return "undefined";
case PEP_rating_cannot_decrypt:
return "cannot_decrypt";
case PEP_rating_have_no_key:
@ -131,7 +135,7 @@ static const char * rating_to_string(PEP_rating rating)
case PEP_rating_under_attack:
return "under_attack";
default:
return "undefined";
assert(0);
}
}
@ -404,6 +408,8 @@ void decorate_message(
replace_opt_field(msg, "X-KeyList", _keylist, clobber);
free(_keylist);
}
msg->rating = rating;
}
/**
@ -2682,6 +2688,9 @@ DYNAMIC_API PEP_STATUS encrypt_message(
if (src->dir == PEP_dir_incoming)
return PEP_ILLEGAL_VALUE;
// Reset the message rating before doing anything...
src->rating = PEP_rating_undefined;
determine_encryption_format(src);
// TODO: change this for multi-encryption in message format 2.0
if (src->enc_format != PEP_enc_none)
@ -2888,7 +2897,16 @@ DYNAMIC_API PEP_STATUS encrypt_message(
}
if (msg) {
decorate_message(session, msg, PEP_rating_undefined, NULL, true, true);
/* Obtain the message rating... */
PEP_rating rating;
status = sent_message_rating(session, msg, & rating);
if (status == PEP_OUT_OF_MEMORY)
goto enomem;
else if (status != PEP_STATUS_OK)
goto pEp_error;
/* ...And store it into the message along with the other decorations. */
decorate_message(session, msg, rating, NULL, true, true);
if (_src->id) {
msg->id = strdup(_src->id);
assert(msg->id);
@ -4934,7 +4952,9 @@ static const char* process_key_claim(message* src,
// There are times when we don't want errors during calls to be fatal. Once any action is taken on that
// status, if we are going to continue processing and not bail from the message, the status needs to be reset
// to PEP_STATUS_OK, or, alternately, we need to be using a temp status variable.
//
// This internal function does *not* set the rating field of the message: that
// part of the job is within decrypt_message.
static PEP_STATUS _decrypt_message(
PEP_SESSION session,
message *src,
@ -6208,7 +6228,6 @@ DYNAMIC_API PEP_STATUS decrypt_message(
message *src,
message **dst,
stringlist_t **keylist,
PEP_rating *rating,
PEP_decrypt_flags_t *flags
)
{
@ -6216,24 +6235,32 @@ DYNAMIC_API PEP_STATUS decrypt_message(
assert(src);
assert(dst);
assert(keylist);
assert(rating);
assert(flags);
if (!(session && src && dst && keylist && rating && flags))
if (!(session && src && dst && keylist && flags))
return PEP_ILLEGAL_VALUE;
if (!(*flags & PEP_decrypt_flag_untrusted_server))
*keylist = NULL;
// Reset the message rating before doing anything. We will compute a new
// value, that _decrypt_message sets as an output parameter.
src->rating = PEP_rating_undefined;
PEP_rating rating = PEP_rating_undefined;
stringlist_t* imported_key_fprs = NULL;
uint64_t changed_key_bitvec = 0;
PEP_STATUS status = _decrypt_message(session, src, dst, keylist,
rating, flags, NULL,
&rating, flags, NULL,
&imported_key_fprs, &changed_key_bitvec);
message *msg = *dst ? *dst : src;
/* Set the rating field of the message. Notice that even in case of non-ok
result status the value of this field may be meaningful. */
msg->rating = rating;
// Ok, now we check to see if it was an administrative message. We do this by testing base_extract for success
// with protocol families.
if (msg && msg->from) {
@ -6247,10 +6274,10 @@ DYNAMIC_API PEP_STATUS decrypt_message(
tmp_status = base_extract_message(session, msg, BASE_SYNC, &size, &data, &sender_fpr);
if (!tmp_status && size && data) {
if (sender_fpr)
signal_Sync_message(session, *rating, data, size, msg->from, sender_fpr);
signal_Sync_message(session, rating, data, size, msg->from, sender_fpr);
// FIXME: this must be changed to sender_fpr
else if (*keylist)
signal_Sync_message(session, *rating, data, size, msg->from, (*keylist)->value);
signal_Sync_message(session, rating, data, size, msg->from, (*keylist)->value);
}
}
if (tmp_status != PEP_STATUS_OK) {
@ -6268,7 +6295,7 @@ DYNAMIC_API PEP_STATUS decrypt_message(
PEP_STATUS tmpstatus = base_extract_message(session, msg, BASE_DISTRIBUTION, &size, &data,
&sender_fpr);
if (!tmpstatus && size && data) {
process_Distribution_message(session, msg, *rating, data, size, sender_fpr);
process_Distribution_message(session, msg, rating, data, size, sender_fpr);
}
}
}
@ -6296,7 +6323,7 @@ DYNAMIC_API PEP_STATUS decrypt_message(
// // if ((!event_sender_fpr) && *keylist)
// // event_sender_fpr = (*keylist)->value;
// if (event_sender_fpr)
// signal_Sync_message(session, *rating, data, size, msg->from, event_sender_fpr);
// signal_Sync_message(session, rating, data, size, msg->from, event_sender_fpr);
// }
// free(sender_fpr);
// }
@ -6424,6 +6451,16 @@ static void _max_comm_type_from_identity_list_preview(
}
}
DYNAMIC_API PEP_STATUS sent_message_rating(
PEP_SESSION session,
message *msg,
PEP_rating *rating
)
{
// FIXME: this is a stub. See ENGINE-847.
return outgoing_message_rating (session, msg, rating);
}
DYNAMIC_API PEP_STATUS outgoing_message_rating(
PEP_SESSION session,
message *msg,
@ -6891,9 +6928,8 @@ DYNAMIC_API PEP_STATUS get_message_trustwords(
// Message is to be decrypted
message *dst = NULL;
stringlist_t *_keylist = keylist;
PEP_rating rating;
PEP_decrypt_flags_t flags;
status = decrypt_message( session, msg, &dst, &_keylist, &rating, &flags);
status = decrypt_message( session, msg, &dst, &_keylist, &flags);
if (status != PEP_STATUS_OK) {
free_message(dst);


+ 34
- 39
src/message_api.h View File

@ -70,9 +70,11 @@ typedef enum _message_wrap_type {
* @brief Encrypt message in memory
*
* @param[in] session session handle
* @param[in,out] src message to encrypt - usually in-only, but can be
* in-out for unencrypted messages; in that case,
* we may attach the key and decorate the message
* @param[in,out] src message to encrypt - usually in-only except for
* the rating field, but can be in-out for
* unencrypted messages; in that case, we may
* attach the key and decorate the message.
* In any case, reset the rating.
* @param[in] extra extra keys for encryption
* @param[out] dst pointer to new encrypted message or NULL if no
* encryption could take place
@ -193,39 +195,6 @@ DYNAMIC_API PEP_STATUS encrypt_message_for_self(
PEP_encrypt_flags_t flags
);
/**
* @enum PEP_rating
*
* @brief TODO
*
*/
typedef enum _PEP_rating {
PEP_rating_undefined = 0,
// no color
PEP_rating_cannot_decrypt = 1,
PEP_rating_have_no_key = 2,
PEP_rating_unencrypted = 3,
PEP_rating_unreliable = 5,
PEP_rating_b0rken = -2,
// yellow
PEP_rating_reliable = 6,
// green
PEP_rating_trusted = 7,
PEP_rating_trusted_and_anonymized = 8,
PEP_rating_fully_anonymous = 9,
// red
PEP_rating_mistrust = -1,
PEP_rating_under_attack = -3
} PEP_rating;
/**
* @enum PEP_color
@ -278,7 +247,9 @@ typedef unsigned int PEP_decrypt_flags_t;
* @brief Decrypt message in memory
*
* @param[in] session session handle
* @param[in,out] src message to decrypt - see warning about identities below
* @param[in,out] src message to decrypt - see warning about identities below.
* the rating field of src (instead of dst) is updated
* in case encryption fails.
* @param[out] dst pointer to new decrypted message or NULL on failure
* @param[in,out] keylist in: stringlist with additional keyids for reencryption if needed
* (will be freed and replaced with output keylist)
@ -286,7 +257,6 @@ typedef unsigned int PEP_decrypt_flags_t;
* first key is signer, additional keys are the ones it was encrypted
* to. Only signer and whichever of the user's keys was used are
* reliable
* @param[out] rating rating for the message
* @param[in,out] flags flags to signal special decryption features
*
* @retval <ERROR> any error status
@ -350,7 +320,6 @@ DYNAMIC_API PEP_STATUS decrypt_message(
message *src,
message **dst,
stringlist_t **keylist,
PEP_rating *rating,
PEP_decrypt_flags_t *flags
);
@ -384,6 +353,32 @@ DYNAMIC_API PEP_STATUS own_message_private_key_details(
);
/**
* <!-- sent_message_rating() -->
*
* @brief Get rating for a sent message
*
* @param[in] session session handle
* @param[in] msg message to get the rating for
* @param[out] rating rating for the message
*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
*
* @warning msg->from must point to a valid pEp_identity
* msg->dir must be PEP_dir_outgoing
* the ownership of msg remains with the caller
*
*/
DYNAMIC_API PEP_STATUS sent_message_rating(
PEP_SESSION session,
message *msg,
PEP_rating *rating
);
// FIXME: the current implementation is a stub, until ENGINE-847 is ready.
/**
* <!-- outgoing_message_rating() -->
*


+ 34
- 0
src/pEpEngine.h View File

@ -214,6 +214,40 @@ typedef enum _PEP_enc_format {
PEP_enc_auto = 255 // figure out automatically where possible
} PEP_enc_format;
/**
* @enum PEP_rating
*
* @brief TODO
*
*/
typedef enum _PEP_rating {
PEP_rating_undefined = 0,
// no color
PEP_rating_cannot_decrypt = 1,
PEP_rating_have_no_key = 2,
PEP_rating_unencrypted = 3,
PEP_rating_unreliable = 5,
PEP_rating_b0rken = -2,
// yellow
PEP_rating_reliable = 6,
// green
PEP_rating_trusted = 7,
PEP_rating_trusted_and_anonymized = 8,
PEP_rating_fully_anonymous = 9,
// red
PEP_rating_mistrust = -1,
PEP_rating_under_attack = -3
} PEP_rating;
/**
* <!-- messageToSend() -->


+ 4
- 5
test/src/AppleMailTest.cc View File

@ -120,7 +120,6 @@ TEST_F(AppleMailTest, check_apple_mail_text_signed_encrypted) {
message* msg_ptr = nullptr;
message* dest_msg = nullptr;
stringlist_t* keylist = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* final_ptr = nullptr;
@ -133,14 +132,14 @@ TEST_F(AppleMailTest, check_apple_mail_text_signed_encrypted) {
final_ptr = msg_ptr;
status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &flags);
final_ptr = dest_msg ? dest_msg : msg_ptr;
output_stream << "shortmsg: " << final_ptr->shortmsg << endl << endl;
output_stream << "longmsg: " << final_ptr->longmsg << endl << endl;
output_stream << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
ASSERT_EQ(color_from_rating(rating) , PEP_color_green);
ASSERT_EQ(color_from_rating(final_ptr->rating) , PEP_color_green);
if (final_ptr == dest_msg)
free_message(dest_msg);
@ -194,14 +193,14 @@ TEST_F(AppleMailTest, check_apple_mail_html_signed_encrypted) {
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_NOTNULL(msg_ptr);
final_ptr = msg_ptr;
status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &flags);
final_ptr = dest_msg ? dest_msg : msg_ptr;
output_stream << "shortmsg: " << final_ptr->shortmsg << endl << endl;
output_stream << "longmsg: " << final_ptr->longmsg << endl << endl;
output_stream << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
ASSERT_EQ(color_from_rating(rating) , PEP_color_green);
ASSERT_EQ(color_from_rating(final_ptr->rating) , PEP_color_green);
if (final_ptr == dest_msg)
free_message(dest_msg);


+ 1
- 2
test/src/AsciiBinaryAtt998Test.cc View File

@ -163,10 +163,9 @@ TEST_F(AsciiBinary998Test, check_engine_895) {
message* dec_msg = NULL;
enc_msg->dir = PEP_dir_incoming;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
ASSERT_EQ(memcmp(data_copy, dec_msg->attachments->value, data_size), 0);


+ 8
- 8
test/src/CheckRenewedExpiredKeyTrustStatusTest.cc View File

@ -117,7 +117,6 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
char* decrypted_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
@ -125,7 +124,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
ASSERT_OK;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_DECRYPTED); // ???
ok = slurp_and_import_key(session, "test_keys/pub/inquisitor-0xA4728718_renewed_pub.asc");
@ -140,6 +139,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
// We don't keep OpenPGP expired keys. We'll have to receive the new one via mail.
PEP_rating rating;
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_OK;
ASSERT_EQ(rating, PEP_rating_reliable);
@ -182,7 +182,6 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
char* decrypted_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
@ -190,7 +189,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
ASSERT_OK;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_DECRYPTED); // ???
ok = slurp_and_import_key(session, "test_keys/pub/inquisitor-0xA4728718_renewed_pub.asc");
@ -205,6 +204,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
// We don't keep OpenPGP expired keys. We'll have to receive the new one via mail.
PEP_rating rating;
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_OK;
ASSERT_EQ(rating, PEP_rating_reliable);
@ -273,7 +273,6 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
stringlist_t* keylist = NULL;
// char* modified_src = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
@ -281,7 +280,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
ASSERT_OK;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_DECRYPTED); // ???
ok = slurp_and_import_key(session, "test_keys/pub/inquisitor-0xA4728718_renewed_pub.asc");
@ -305,6 +304,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
msg2->longmsg = strdup("Blahblahblah!");
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
PEP_rating rating;
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_OK;
ASSERT_EQ(rating, PEP_rating_trusted);
@ -347,7 +347,6 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
char* decrypted_msg = NULL;
stringlist_t* keylist = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
@ -355,7 +354,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
ASSERT_OK;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_DECRYPTED);
ok = slurp_and_import_key(session, "test_keys/pub/inquisitor-0xA4728718_renewed_pub.asc");
@ -370,6 +369,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
msg2->longmsg = strdup("Blahblahblah!");
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
PEP_rating rating;
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_OK;
ASSERT_EQ(rating , PEP_rating_reliable);


+ 2
- 3
test/src/DecryptAttachPrivateKeyTrustedTest.cc View File

@ -156,7 +156,6 @@ TEST_F(DecryptAttachPrivateKeyTrustedTest, check_decrypt_attach_private_key_trus
output_stream << "decrypt with attached private key: Same address, same user_id, trusted" << endl;
message* decrypted_text = NULL;
stringlist_t* keylist_used = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
output_stream << "Trusting own key for " << same_addr_same_uid->user_id << " and " << same_addr_same_uid->fpr << endl;
@ -172,7 +171,7 @@ TEST_F(DecryptAttachPrivateKeyTrustedTest, check_decrypt_attach_private_key_trus
flags = 0;
status = decrypt_message(session, encoded_text, &decrypted_text,
&keylist_used, &rating, &flags);
&keylist_used, &flags);
status = get_trust(session, same_addr_same_uid);
ASSERT_EQ(same_addr_same_uid->comm_type, PEP_ct_pEp);
@ -180,7 +179,7 @@ TEST_F(DecryptAttachPrivateKeyTrustedTest, check_decrypt_attach_private_key_trus
flags = 0;
status = decrypt_message(session, encoded_text, &decrypted_text,
&keylist_used, &rating, &flags);
&keylist_used, &flags);
output_stream << "Status: " << tl_status_string(status) << endl;
ASSERT_EQ(status, PEP_STATUS_OK);


+ 1
- 2
test/src/DecryptAttachPrivateKeyUntrustedTest.cc View File

@ -163,7 +163,6 @@ TEST_F(DecryptAttachPrivateKeyUntrustedTest, check_decrypt_attach_private_key_un
output_stream << "Same address, same user_id, untrusted" << endl;
message* decrypted_text = NULL;
stringlist_t* keylist_used = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = get_trust(session, same_addr_same_uid);
@ -178,7 +177,7 @@ TEST_F(DecryptAttachPrivateKeyUntrustedTest, check_decrypt_attach_private_key_un
flags = 0;
status = decrypt_message(session, encoded_text, &decrypted_text,
&keylist_used, &rating, &flags);
&keylist_used, &flags);
status = get_trust(session, same_addr_same_uid);
ASSERT_EQ(same_addr_same_uid->comm_type, PEP_ct_pEp_unconfirmed);


+ 2
- 4
test/src/ElevatedAttachmentsTest.cc View File

@ -268,10 +268,9 @@ TEST_F(ElevatedAttachmentsTest, check_encrypt_decrypt_message) {
message *dec_msg = NULL;
stringlist_t *keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_STREQ(dec_msg->shortmsg, enc_msg->shortmsg);
ASSERT_STREQ(msg->longmsg, dec_msg->longmsg);
@ -404,10 +403,9 @@ TEST_F(ElevatedAttachmentsTest, check_encrypt_decrypt_message_elevated) {
message *dec_msg = NULL;
stringlist_t *keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, art_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, art_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_TRUE(dec_msg);
// today the engine is sucking keys in


+ 10
- 8
test/src/EncryptForIdentityTest.cc View File

@ -175,12 +175,12 @@ TEST_F(EncryptForIdentityTest, check_encrypt_for_identity) {
message* decrypted_msg = nullptr;
stringlist_t* keylist_used = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags;
flags = 0;
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_NOTNULL(decrypted_msg);
PEP_rating rating = decrypted_msg->rating;
ASSERT_NOTNULL(keylist_used);
ASSERT_NE(rating, 0);
ASSERT_TRUE(status == PEP_DECRYPTED && rating == PEP_rating_unreliable);
@ -226,8 +226,9 @@ TEST_F(EncryptForIdentityTest, check_encrypt_for_identity) {
output_stream << "message encrypted.\n";
flags = 0;
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_NOTNULL(decrypted_msg);
rating = decrypted_msg->rating;
ASSERT_NOTNULL(keylist_used);
ASSERT_NE(rating, 0);
ASSERT_TRUE(status == PEP_DECRYPTED && rating == PEP_rating_unreliable);
@ -311,12 +312,12 @@ TEST_F(EncryptForIdentityTest, check_encrypt_for_identity) {
free_stringlist(keylist_used);
keylist_used = nullptr;
PEP_decrypt_flags_t mimeflags;
PEP_rating mimerating;
mimeflags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist_used, &mimerating, &mimeflags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist_used, &mimeflags);
ASSERT_NOTNULL(dec_msg);
PEP_rating mimerating = dec_msg->rating;
ASSERT_NOTNULL(keylist_used);
ASSERT_NE(mimerating, 0);
@ -434,12 +435,12 @@ TEST_F(EncryptForIdentityTest, check_encrypt_for_identity_with_URI) {
message* decrypted_msg = nullptr;
stringlist_t* keylist_used = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags;
flags = 0;
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_NOTNULL(decrypted_msg);
PEP_rating rating = decrypted_msg->rating;
ASSERT_NOTNULL(keylist_used);
ASSERT_NE(rating, 0);
ASSERT_TRUE(status == PEP_DECRYPTED && rating == PEP_rating_unreliable);
@ -485,8 +486,9 @@ TEST_F(EncryptForIdentityTest, check_encrypt_for_identity_with_URI) {
output_stream << "message encrypted.\n";
flags = 0;
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_NOTNULL(decrypted_msg);
rating = decrypted_msg->rating;
ASSERT_NOTNULL(keylist_used);
ASSERT_NE(rating, 0);
ASSERT_TRUE(status == PEP_DECRYPTED && rating == PEP_rating_unreliable);


+ 7
- 7
test/src/Engine463Test.cc View File

@ -99,10 +99,9 @@ TEST_F(Engine463Test, check_engine_463_no_own_key) {
message* decrypted_msg = NULL;
stringlist_t* keylist_used = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_OK;
}
@ -126,10 +125,9 @@ TEST_F(Engine463Test, check_engine_463_sender_expired_and_renewed) {
message* decrypted_msg = NULL;
stringlist_t* keylist_used = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
free(decrypted_msg);
@ -139,15 +137,17 @@ TEST_F(Engine463Test, check_engine_463_sender_expired_and_renewed) {
pEp_identity* expired_inquisitor = new_identity("inquisitor@darthmama.org", NULL, NULL, "Lady Claire Trevelyan");
PEP_rating rating;
status = identity_rating(session, expired_inquisitor, &rating);
ASSERT_OK;
ASSERT_EQ(rating , PEP_rating_reliable);
flags = 0;
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_NOTNULL(decrypted_msg);
ASSERT_OK;
rating = decrypted_msg->rating;
ASSERT_EQ(rating , PEP_rating_reliable);
free_identity(expired_inquisitor);
@ -180,10 +180,9 @@ TEST_F(Engine463Test, check_engine_463_sender_expired_and_renewed) {
message* decrypted_msg = NULL;
stringlist_t* keylist_used = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
free(decrypted_msg);
@ -200,6 +199,7 @@ TEST_F(Engine463Test, check_engine_463_sender_expired_and_renewed) {
msg2->longmsg = strdup("Blahblahblah!");
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
PEP_rating rating;
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_OK;
ASSERT_EQ(rating , PEP_rating_reliable);


+ 1
- 2
test/src/Engine514Test.cc View File

@ -268,9 +268,8 @@ TEST_F(Engine514Test, check_engine514_encrypted) {
message* dec_msg = NULL;
PEP_decrypt_flags_t flags = 0;
stringlist_t* keylist = NULL;
PEP_rating rating;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_STREQ(msg->attachments->mime_type, "message/rfc822");
ASSERT_NULL(msg->attachments->next);


+ 1
- 2
test/src/Engine619Test.cc View File

@ -439,11 +439,10 @@ TEST_F(Engine619Test, decrypt_message_with_private_key) {
message *message_dst;
stringlist_t* keys = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, message_src, & message_dst,
& keys, & rating, & flags);
& keys, & flags);
/* It is normal and expected that decryption fails here: this message is
unencrypted. The point of this test is to arrive at a call to
pgp_import_keydata , which used to corrut the heap (ENGINE-619). */


+ 1
- 2
test/src/Engine655Test.cc View File

@ -143,9 +143,8 @@ TEST_F(Engine655Test, check_engine655) {
//
keylist = NULL;
message* dec_msg = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
EXPECT_EQ(status, PEP_DECRYPTED); // really, expect PEP_STATUS_OK, but it doesn't verify and msg may be broken
// EXPECT_NE(ptext, nullptr);
// EXPECT_NE(keylist, nullptr);


+ 1
- 2
test/src/Engine704Test.cc View File

@ -128,10 +128,9 @@ TEST_F(Engine704Test, check_engine704) {
message* dec_msg = NULL;
enc_msg->dir = PEP_dir_incoming;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_STREQ(dec_msg->from->username, alicename);
ASSERT_STREQ(dec_msg->to->ident->username, bobname);
}

+ 4
- 3
test/src/ExternalRevokeTest.cc View File

@ -196,7 +196,6 @@ TEST_F(ExternalRevokeTest, check_external_revoke) {
outgoing_msg = NULL;
stringlist_t* keylist = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags;
output_stream << endl << "---------------------------------------------------------" << endl;
@ -205,9 +204,10 @@ TEST_F(ExternalRevokeTest, check_external_revoke) {
flags = 0;
output_stream << "Decrypting message." << endl;
status = decrypt_message(session, encrypted_outgoing_msg, &outgoing_msg, &keylist, &rating, &flags);
status = decrypt_message(session, encrypted_outgoing_msg, &outgoing_msg, &keylist, &flags);
output_stream << "Decrypted message with status " << tl_status_string(status) << endl;
ASSERT_OK;
PEP_rating rating = outgoing_msg->rating;
ASSERT_EQ(rating , PEP_rating_trusted);
// check rating
@ -384,10 +384,11 @@ TEST_F(ExternalRevokeTest, check_external_revoke) {
flags = 0;
status = decrypt_message(session, encrypted_outgoing_msg, &decrypted_msg, &keylist, &rating, &flags);
status = decrypt_message(session, encrypted_outgoing_msg, &decrypted_msg, &keylist, &flags);
output_stream << "Decryption returns with status " << tl_status_string(status) << endl;
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_NOTNULL(decrypted_msg);
rating = decrypted_msg->rating;
// check rating
output_stream << "Rating of decrypted message to trusted recip: " << tl_rating_string(rating) << endl;


+ 34
- 59
test/src/GroupEncryptionTest.cc View File

@ -1030,10 +1030,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_create_receive_member_1) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Ok, so that worked.
@ -1122,10 +1121,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_create_receive_member_2) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Ok, so that worked.
@ -1187,10 +1185,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_create_receive_member_3) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Ok, so that worked.
@ -1252,10 +1249,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_create_receive_member_4) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Ok, so that worked.
@ -1486,10 +1482,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_join_member_1) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
pEp_identity* group_identity = new_identity(group_1_address, NULL, own_id, NULL);
@ -1560,10 +1555,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_join_member_2) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
pEp_identity* group_identity = new_identity(group_1_address, NULL, own_id, NULL);
@ -1620,10 +1614,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_join_member_3) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
pEp_identity* group_identity = new_identity(group_1_address, NULL, own_id, NULL);
@ -1680,10 +1673,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_join_member_4) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
pEp_identity* group_identity = new_identity(group_1_address, NULL, own_id, NULL);
@ -1777,10 +1769,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_join_receive) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Ok, so that worked.
@ -1877,9 +1868,8 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_send) {
mime_decode_message(msg_str.c_str(), msg_str.size(), &msg, NULL);
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Member 1
@ -1891,9 +1881,8 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_send) {
dec_msg = NULL;
free_stringlist(keylist);
keylist = NULL;
rating = PEP_rating_undefined;
flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Member 2
@ -1905,9 +1894,8 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_send) {
dec_msg = NULL;
free_stringlist(keylist);
keylist = NULL;
rating = PEP_rating_undefined;
flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(msg);
@ -2071,9 +2059,8 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_receive) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
@ -2111,7 +2098,7 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_receive) {
dec_msg = NULL;
keylist = NULL;
flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
status = retrieve_own_membership_info_for_group_and_identity(session, group, me);
@ -2182,10 +2169,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_join_member_unknown) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Now make sure we didn't do anything with the message
@ -2234,8 +2220,7 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_group_unknown) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_decrypt_flags_t flags = 0;
PEP_rating rating;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
pEp_identity* group_identity = new_identity(group_1_address, NULL, own_id, NULL);
@ -2617,10 +2602,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_not_manager) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(msg);
@ -2636,7 +2620,7 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_not_manager) {
keylist = NULL;
flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
free_message(msg);
ASSERT_OK;
free_message(dec_msg);
@ -2662,7 +2646,7 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_not_manager) {
keylist = NULL;
flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
free_message(msg);
free_message(dec_msg);
ASSERT_OK;
@ -3100,15 +3084,14 @@ TEST_F(GroupEncryptionTest, check_protocol_group_key_reset_two_recents) {
ASSERT_NE(message_2, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, message_1, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_1, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
status = decrypt_message(session, message_2, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_2, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
@ -3200,13 +3183,12 @@ TEST_F(GroupEncryptionTest, check_group_key_reset_receive_member_2) {
message* enc_msg = NULL;
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
enc_msg = string_to_msg(invite);
ASSERT_NE(enc_msg, nullptr);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
pEp_identity* group_ident = new_identity(group_1_address, NULL, "MEMBER2", group_1_name);
@ -3225,7 +3207,7 @@ TEST_F(GroupEncryptionTest, check_group_key_reset_receive_member_2) {
enc_msg = string_to_msg(resetmsg);
ASSERT_NE(enc_msg, nullptr);
free_message(dec_msg);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
bool is_revoked;
@ -3262,11 +3244,10 @@ TEST_F(GroupEncryptionTest, check_group_key_reset_receive_partner_1) {
message* enc_msg = string_to_msg(slurp(string("test_mails/group_key_reset_mixed_output_to_partner_public_") + manager_2_address + ".eml"));
ASSERT_NE(enc_msg, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// FIXME: reinstate this when key election removal is in - fails due to delete_keypair
@ -3305,11 +3286,10 @@ TEST_F(GroupEncryptionTest, check_group_key_reset_receive_partner_2) {
message* enc_msg = string_to_msg(slurp(string("test_mails/group_key_reset_mixed_output_to_partner_public_") + me->address + ".eml"));
ASSERT_NE(enc_msg, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// FIXME: reinstate this when key election removal is in - fails due to delete_keypair
@ -3448,15 +3428,14 @@ TEST_F(GroupEncryptionTest, check_protocol_group_key_reset_two_recents_two_missi
ASSERT_NE(message_2, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, message_1, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_1, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
status = decrypt_message(session, message_2, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_2, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
@ -3618,11 +3597,10 @@ TEST_F(GroupEncryptionTest, check_protocol_group_key_reset_one_recent_all_missin
ASSERT_NE(message_1, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, message_1, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_1, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
free_message(message_1);
@ -3871,15 +3849,14 @@ TEST_F(GroupEncryptionTest, check_protocol_remove_member_from_group_two_recents)
ASSERT_NE(message_2, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, message_1, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_1, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
status = decrypt_message(session, message_2, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_2, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
@ -4080,15 +4057,14 @@ TEST_F(GroupEncryptionTest, check_protocol_remove_member_not_joined_from_group_t
ASSERT_NE(message_2, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, message_1, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_1, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
status = decrypt_message(session, message_2, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_2, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
@ -4288,15 +4264,14 @@ TEST_F(GroupEncryptionTest, check_protocol_remove_unknown_member_from_group_two_
ASSERT_NE(message_2, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, message_1, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_1, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
status = decrypt_message(session, message_2, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_2, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;


+ 3
- 3
test/src/HeaderKeyImportTest.cc View File

@ -726,14 +726,14 @@ TEST_F(HeaderKeyImportTest, check_header_key_import) {
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags;
flags = 0;
message* enc_msg = string_to_msg(strmsg);
PEP_STATUS status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
ASSERT_EQ(rating , PEP_rating_reliable);
PEP_STATUS status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
PEP_rating rating = dec_msg->rating;
ASSERT_EQ(rating, PEP_rating_reliable);
pEp_identity* alice_check = new_identity("pep.test.alice@pep-project.org", NULL, NULL, "pEp Test Alice");
status = update_identity(session, alice_check);


+ 18
- 36
test/src/KeyAttachmentTest.cc View File

@ -105,9 +105,8 @@ TEST_F(KeyAttachmentTest, check_key_attach_inline) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
#if KEYS_STAY_ATTACHED
ASSERT_NOTNULL(dec_msg->attachments );
@ -132,9 +131,8 @@ TEST_F(KeyAttachmentTest, check_key_plus_encr_att_inline) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
ASSERT_NOTNULL(dec_msg);
#if KEYS_STAY_ATTACHED
@ -167,9 +165,8 @@ TEST_F(KeyAttachmentTest, check_encr_att_plus_key_inline) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);