Reverted change in decrypt_message return value (now returns PEP_DECRYPT if signature verification failed, not PEP_STATUS_OK anymore). Reflected in unit tests and header's documentation
authorEdouard Tisserant <edouard@pep-project.org>
Wed, 14 Jun 2017 19:37:20 +0200
changeset 1858600dc0395ec0
parent 1854 b76315c0117d
child 1859 acf5c59a49e3
Reverted change in decrypt_message return value (now returns PEP_DECRYPT if signature verification failed, not PEP_STATUS_OK anymore). Reflected in unit tests and header's documentation
src/message_api.c
src/message_api.h
test/encrypt_for_identity_test.cc
     1.1 --- a/src/message_api.c	Wed Jun 14 16:45:54 2017 +0200
     1.2 +++ b/src/message_api.c	Wed Jun 14 19:37:20 2017 +0200
     1.3 @@ -2053,6 +2053,8 @@
     1.4  
     1.5          if (status != PEP_STATUS_OK)
     1.6              GOTO(pep_error);
     1.7 +
     1.8 +        status = decrypt_status;
     1.9      }
    1.10      else
    1.11      {
    1.12 @@ -2107,7 +2109,7 @@
    1.13      *dst = msg;
    1.14      *keylist = _keylist;
    1.15  
    1.16 -    return PEP_STATUS_OK;
    1.17 +    return ADD_TO_LOG(status);
    1.18  
    1.19  enomem:
    1.20      status = PEP_OUT_OF_MEMORY;
     2.1 --- a/src/message_api.h	Wed Jun 14 16:45:54 2017 +0200
     2.2 +++ b/src/message_api.h	Wed Jun 14 19:37:20 2017 +0200
     2.3 @@ -227,7 +227,9 @@
     2.4  //      flags (out)         flags to signal special decryption features
     2.5  //
     2.6  //  return value:
     2.7 -//      error status or PEP_STATUS_OK on success
     2.8 +//      error status 
     2.9 +//      or PEP_DECRYPTED if message decrypted but not verified
    2.10 +//      or PEP_STATUS_OK on success
    2.11  //
    2.12  //	caveat:
    2.13  //	    the ownership of src remains with the caller
     3.1 --- a/test/encrypt_for_identity_test.cc	Wed Jun 14 16:45:54 2017 +0200
     3.2 +++ b/test/encrypt_for_identity_test.cc	Wed Jun 14 19:37:20 2017 +0200
     3.3 @@ -99,7 +99,7 @@
     3.4      assert(decrypted_msg);
     3.5      assert(keylist_used);
     3.6      assert(rating);
     3.7 -    assert(status == PEP_STATUS_OK && rating == PEP_rating_unreliable);
     3.8 +    assert(status == PEP_DECRYPTED && rating == PEP_rating_unreliable);
     3.9      PEP_comm_type ct = encrypted_msg->from->comm_type;
    3.10      assert(ct == PEP_ct_pEp || ct == PEP_ct_pEp_unconfirmed || ct == PEP_ct_OpenPGP || ct == PEP_ct_OpenPGP_unconfirmed );
    3.11  
    3.12 @@ -169,7 +169,7 @@
    3.13      assert(keylist_used);
    3.14      assert(mimerating);
    3.15                               
    3.16 -    assert(status == PEP_STATUS_OK && mimerating == PEP_rating_unreliable);
    3.17 +    assert(status == PEP_DECRYPTED && mimerating == PEP_rating_unreliable);
    3.18  
    3.19      cout << "Decrypted message:" << endl;
    3.20      cout << decrypted_mimetext << endl;