Browse Source

ENGINE-911: separated API from internal calls in most files (the most egregious cases) - also put DYNAMIC_API on one of the group functions where it was missing

master
Krista Bennett 6 months ago
parent
commit
fc3a6693b0
88 changed files with 1263 additions and 1088 deletions
  1. +2
    -0
      src/group.c
  2. +1
    -252
      src/group.h
  3. +270
    -0
      src/group_internal.h
  4. +3
    -3
      src/identity_list.h
  5. +3
    -0
      src/key_reset.c
  6. +0
    -199
      src/key_reset.h
  7. +228
    -0
      src/key_reset_internal.h
  8. +2
    -0
      src/message_api.c
  9. +0
    -634
      src/pEpEngine.h
  10. +671
    -0
      src/pEpEngine_internal.h
  11. +2
    -0
      src/pEp_internal.h
  12. +1
    -0
      test/src/AsciiBinaryAtt998Test.cc
  13. +1
    -0
      test/src/BCCTest.cc
  14. +1
    -0
      test/src/BareDecryptShellTest.cc
  15. +1
    -0
      test/src/BareEncryptShellTest.cc
  16. +1
    -0
      test/src/BlacklistAcceptNewKeyTest.cc
  17. +1
    -0
      test/src/BlacklistTest.cc
  18. +2
    -0
      test/src/CheckRenewedExpiredKeyTrustStatusTest.cc
  19. +1
    -0
      test/src/CleanInvalidOwnKeysTest.cc
  20. +1
    -0
      test/src/CrashdumpTest.cc
  21. +1
    -0
      test/src/DecryptAttachPrivateKeyTrustedTest.cc
  22. +1
    -0
      test/src/DecryptAttachPrivateKeyUntrustedTest.cc
  23. +1
    -0
      test/src/DeleteKeyTest.cc
  24. +1
    -0
      test/src/EmptyLongmsgFullHtmlTest.cc
  25. +1
    -0
      test/src/EncryptAttachPrivateKeyTest.cc
  26. +1
    -0
      test/src/EncryptForIdentityTest.cc
  27. +1
    -0
      test/src/EncryptMissingPrivateKeyTest.cc
  28. +1
    -0
      test/src/Engine358Test.cc
  29. +1
    -0
      test/src/Engine463Test.cc
  30. +1
    -0
      test/src/Engine514Test.cc
  31. +1
    -0
      test/src/Engine655Test.cc
  32. +1
    -0
      test/src/Engine703Test.cc
  33. +1
    -0
      test/src/Engine704Test.cc
  34. +1
    -0
      test/src/Engine715Test.cc
  35. +1
    -0
      test/src/Engine736Test.cc
  36. +1
    -0
      test/src/ExpiredSubkeyTest.cc
  37. +1
    -0
      test/src/ExportKeyTest.cc
  38. +1
    -0
      test/src/ExternalRevokeTest.cc
  39. +1
    -0
      test/src/GetKeyRatingForUserTest.cc
  40. +2
    -0
      test/src/GroupEncryptionTest.cc
  41. +1
    -0
      test/src/HeaderKeyImportTest.cc
  42. +1
    -0
      test/src/I18nTest.cc
  43. +1
    -0
      test/src/IdentEncFormatTest.cc
  44. +1
    -0
      test/src/IdentityListTest.cc
  45. +1
    -0
      test/src/ImportKeyTest.cc
  46. +1
    -0
      test/src/IsOwnKeyTest.cc
  47. +1
    -0
      test/src/KeyAttachmentTest.cc
  48. +1
    -0
      test/src/KeyManipulationTest.cc
  49. +2
    -0
      test/src/KeyResetMessageTest.cc
  50. +1
    -0
      test/src/KeyeditTest.cc
  51. +1
    -0
      test/src/KeyringImportTest.cc
  52. +1
    -0
      test/src/LeastColorGroupTest.cc
  53. +1
    -0
      test/src/LeastCommonDenomColorTest.cc
  54. +1
    -0
      test/src/LiteralFilenameTest.cc
  55. +1
    -0
      test/src/LookupTest.cc
  56. +1
    -0
      test/src/LotsOfKeysTest.cc
  57. +1
    -0
      test/src/MapAsn1Test.cc
  58. +1
    -0
      test/src/Message2_1Test.cc
  59. +1
    -0
      test/src/MessageApiTest.cc
  60. +1
    -0
      test/src/MessageNullFromTest.cc
  61. +1
    -0
      test/src/MessageTwoPointOhTest.cc
  62. +1
    -0
      test/src/MimeTest.cc
  63. +1
    -0
      test/src/NoOwnIdentWritesOnDecryptTest.cc
  64. +1
    -0
      test/src/OwnIdentitiesRetrieveTest.cc
  65. +1
    -0
      test/src/OwnKeysRetrieveTest.cc
  66. +1
    -0
      test/src/PassphraseTest.cc
  67. +1
    -0
      test/src/PepSubjectReceivedTest.cc
  68. +1
    -0
      test/src/PgpBinaryTest.cc
  69. +2
    -0
      test/src/PgpListKeysTest.cc
  70. +1
    -0
      test/src/Quick11to12Test.cc
  71. +1
    -0
      test/src/ReencryptPlusExtraKeysTest.cc
  72. +1
    -0
      test/src/RevocationTest.cc
  73. +1
    -0
      test/src/RevokeRegenAttachTest.cc
  74. +1
    -0
      test/src/SenderFPRTest.cc
  75. +1
    -0
      test/src/SequenceTest.cc
  76. +1
    -0
      test/src/SignOnlyTest.cc
  77. +1
    -0
      test/src/SimpleBodyNotAltTest.cc
  78. +1
    -0
      test/src/StickyBitTest.cc
  79. +1
    -0
      test/src/StrnstrTest.cc
  80. +1
    -0
      test/src/SubkeyRatingEvalTest.cc
  81. +1
    -0
      test/src/TrustwordsTest.cc
  82. +1
    -0
      test/src/URIAddressTest.cc
  83. +1
    -0
      test/src/UnencryptedPepMailTest.cc
  84. +1
    -0
      test/src/UpdateIdAndMyselfTest.cc
  85. +1
    -0
      test/src/UserIDAliasTest.cc
  86. +1
    -0
      test/src/UserIdCollisionTest.cc
  87. +1
    -0
      test/src/VerifyTest.cc
  88. +1
    -0
      test/src/test_util.cc

+ 2
- 0
src/group.c View File

@ -2,6 +2,8 @@
// see LICENSE.txt
#include "group.h"
#include "group_internal.h"
#include "pEp_internal.h"
#include "message_api.h"
#include "distribution_codec.h"


+ 1
- 252
src/group.h View File

@ -5,7 +5,6 @@
// see LICENSE.txt
#include "message_api.h"
#include "../asn.1/Distribution.h"
#ifdef __cplusplus
extern "C" {
@ -334,7 +333,7 @@ DYNAMIC_API PEP_STATUS group_invite_member(
* @todo Revamp implementation and execute key reset
*
*/
PEP_STATUS group_remove_member(
DYNAMIC_API PEP_STATUS group_remove_member(
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *group_member
@ -366,256 +365,6 @@ DYNAMIC_API PEP_STATUS group_rating(
PEP_rating *rating
);
/*************************************************************************************************
* Internal functions
*************************************************************************************************/
/**
* @internal
*
* <!-- group_enable() -->
*
* @brief Mark an extant group in the database as active
*
* @param[in] session associated session object
* @param[in] group_identity the pEp_identity object representing the group. Must contain at least
* a user_id and address
*
* @retval PEP_STATUS_OK on success
* error on failure
*
* @ownership all arguments belong to the callee
*
*/
PEP_STATUS group_enable(
PEP_SESSION session,
pEp_identity *group_identity
);
/**
* @internal
*
* @param session
* @param group_identity
* @param group_member
* @return
*/
PEP_STATUS group_add_member(
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *group_member
);
// leave_group() - leave group as member
//
// params:
// group_identity (in)
// as_member (in) own identity
/**
* @internal
*
* @param session
* @param group_identity
* @param member_identity
* @return
*/
PEP_STATUS leave_group(
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *member_identity
);
/**
* @internal
*
* @param session
* @param group_identity
* @param exists
* @return
*/
PEP_STATUS exists_group(
PEP_SESSION session,
pEp_identity* group_identity,
bool* exists
);
// group_identity stays with caller now - FIXME: adapt assumptions
/**
* @internal
*
* @param session
* @param group_identity
* @param group_info
* @return
*/
PEP_STATUS retrieve_group_info(
PEP_SESSION session,
pEp_identity* group_identity,
pEp_group** group_info
);
/**
* @internal
*
* @param session
* @param group_identity
* @param active
* @return
*/
PEP_STATUS is_group_active(
PEP_SESSION session,
pEp_identity*
group_identity,
bool* active);
/**
* @internal
*
* @param session
* @param group_identity
* @param members
* @return
*/
PEP_STATUS retrieve_full_group_membership(
PEP_SESSION session,
pEp_identity* group_identity,
member_list** members);
/**
* @internal
*
* @param session
* @param group_identity
* @param members
* @return
*/
PEP_STATUS retrieve_active_group_membership(
PEP_SESSION session,
pEp_identity* group_identity,
member_list** members);
/**
* @internal
*
* @param session
* @param group
* @return
*/
PEP_STATUS create_group_entry(PEP_SESSION session,
pEp_group* group);
/**
* @internal
*
* @param session
* @param group_identity
* @param manager
* @param own_identity_recip
* @return
*/
PEP_STATUS add_own_membership_entry(PEP_SESSION session,
pEp_identity* group_identity,
pEp_identity* manager,
pEp_identity* own_identity_recip);
/**
* @internal
*
* @param session
* @param group
* @param own_identity
* @return
*/
PEP_STATUS retrieve_own_membership_info_for_group_and_identity(PEP_SESSION session,
pEp_group* group,
pEp_identity* own_identity);
/**
* @internal
*
* @param session
* @param msg
* @param rating
* @param dist
* @return
*/
PEP_STATUS receive_managed_group_message(PEP_SESSION session, message* msg, PEP_rating rating, Distribution_t* dist);
/**
* @internal
*
* @param session
* @param group_identity
* @param mbr_idents
* @return
*/
PEP_STATUS retrieve_active_member_list(
PEP_SESSION session,
pEp_identity* group_identity,
member_list** mbr_idents);
/**
* @internal
*
* @param session
* @param group_identity
* @param as_member
* @param active
* @return
*/
PEP_STATUS set_membership_status(PEP_SESSION session,
pEp_identity* group_identity,
pEp_identity* as_member,
bool active);
/**
* @internal
*
* @param session
* @param group_identity
* @param is_own
* @return
*/
PEP_STATUS is_own_group_identity(PEP_SESSION session, pEp_identity* group_identity, bool* is_own);
/**
* @internal
*
* @param memberlist
* @return
*/
identity_list* member_list_to_identity_list(member_list* memberlist);
/**
*
* @param session
* @param group_identity
* @param manager
* @return
*/
PEP_STATUS get_group_manager(PEP_SESSION session,
pEp_identity* group_identity,
pEp_identity** manager);
/**
*
* @param session
* @param group_identity
* @param own_manager
* @return
*/
PEP_STATUS is_group_mine(PEP_SESSION session, pEp_identity* group_identity, bool* own_manager);
/**
*
* @param session
* @param group_identity
* @param member
* @param is_active
* @return
*/
PEP_STATUS is_active_group_member(PEP_SESSION session, pEp_identity* group_identity,
pEp_identity* member, bool* is_active);
#ifdef __cplusplus
}
#endif


+ 270
- 0
src/group_internal.h View File

@ -0,0 +1,270 @@
#ifndef GROUP_INTERNAL_H
#define GROUP_INTERNAL_H
// This file is under GNU General Public License 3.0
// see LICENSE.txt
#include "message_api.h"
#include "../asn.1/Distribution.h"
#include "group.h"
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************************************
* Internal functions
*************************************************************************************************/
/**
* @internal
*
* <!-- group_enable() -->
*
* @brief Mark an extant group in the database as active
*
* @param[in] session associated session object
* @param[in] group_identity the pEp_identity object representing the group. Must contain at least
* a user_id and address
*
* @retval PEP_STATUS_OK on success
* error on failure
*
* @ownership all arguments belong to the callee
*
*/
PEP_STATUS group_enable(
PEP_SESSION session,
pEp_identity *group_identity
);
/**
* @internal
*
* @param session
* @param group_identity
* @param group_member
* @return
*/
PEP_STATUS group_add_member(
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *group_member
);
// leave_group() - leave group as member
//
// params:
// group_identity (in)
// as_member (in) own identity
/**
* @internal
*
* @param session
* @param group_identity
* @param member_identity
* @return
*/
PEP_STATUS leave_group(
PEP_SESSION session,
pEp_identity *group_identity,
pEp_identity *member_identity
);
/**
* @internal
*
* @param session
* @param group_identity
* @param exists
* @return
*/
PEP_STATUS exists_group(
PEP_SESSION session,
pEp_identity* group_identity,
bool* exists
);
// group_identity stays with caller now - FIXME: adapt assumptions
/**
* @internal
*
* @param session
* @param group_identity
* @param group_info
* @return
*/
PEP_STATUS retrieve_group_info(
PEP_SESSION session,
pEp_identity* group_identity,
pEp_group** group_info
);
/**
* @internal
*
* @param session
* @param group_identity
* @param active
* @return
*/
PEP_STATUS is_group_active(
PEP_SESSION session,
pEp_identity*
group_identity,
bool* active);
/**
* @internal
*
* @param session
* @param group_identity
* @param members
* @return
*/
PEP_STATUS retrieve_full_group_membership(
PEP_SESSION session,
pEp_identity* group_identity,
member_list** members);
/**
* @internal
*
* @param session
* @param group_identity
* @param members
* @return
*/
PEP_STATUS retrieve_active_group_membership(
PEP_SESSION session,
pEp_identity* group_identity,
member_list** members);
/**
* @internal
*
* @param session
* @param group
* @return
*/
PEP_STATUS create_group_entry(PEP_SESSION session,
pEp_group* group);
/**
* @internal
*
* @param session
* @param group_identity
* @param manager
* @param own_identity_recip
* @return
*/
PEP_STATUS add_own_membership_entry(PEP_SESSION session,
pEp_identity* group_identity,
pEp_identity* manager,
pEp_identity* own_identity_recip);
/**
* @internal
*
* @param session
* @param group
* @param own_identity
* @return
*/
PEP_STATUS retrieve_own_membership_info_for_group_and_identity(PEP_SESSION session,
pEp_group* group,
pEp_identity* own_identity);
/**
* @internal
*
* @param session
* @param msg
* @param rating
* @param dist
* @return
*/
PEP_STATUS receive_managed_group_message(PEP_SESSION session, message* msg, PEP_rating rating, Distribution_t* dist);
/**
* @internal
*
* @param session
* @param group_identity
* @param mbr_idents
* @return
*/
PEP_STATUS retrieve_active_member_list(
PEP_SESSION session,
pEp_identity* group_identity,
member_list** mbr_idents);
/**
* @internal
*
* @param session
* @param group_identity
* @param as_member
* @param active
* @return
*/
PEP_STATUS set_membership_status(PEP_SESSION session,
pEp_identity* group_identity,
pEp_identity* as_member,
bool active);
/**
* @internal
*
* @param session
* @param group_identity
* @param is_own
* @return
*/
PEP_STATUS is_own_group_identity(PEP_SESSION session, pEp_identity* group_identity, bool* is_own);
/**
* @internal
*
* @param memberlist
* @return
*/
identity_list* member_list_to_identity_list(member_list* memberlist);
/**
*
* @param session
* @param group_identity
* @param manager
* @return
*/
PEP_STATUS get_group_manager(PEP_SESSION session,
pEp_identity* group_identity,
pEp_identity** manager);
/**
*
* @param session
* @param group_identity
* @param own_manager
* @return
*/
PEP_STATUS is_group_mine(PEP_SESSION session, pEp_identity* group_identity, bool* own_manager);
/**
*
* @param session
* @param group_identity
* @param member
* @param is_active
* @return
*/
PEP_STATUS is_active_group_member(PEP_SESSION session, pEp_identity* group_identity,
pEp_identity* member, bool* is_active);
#ifdef __cplusplus
}
#endif
#endif

+ 3
- 3
src/identity_list.h View File

@ -109,16 +109,16 @@ DYNAMIC_API int identity_list_length(const identity_list *id_list);
// Internal
/**
* <!-- set_all_userids_in_list() -->
*
*
* @brief TODO
*
*
* @param[in] id_list identity_list*
* @param[in] user_id const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval PEP_OUT_OF_MEMORY out of memory
*
*
*/
PEP_STATUS set_all_userids_in_list(identity_list* id_list, const char* user_id);


+ 3
- 0
src/key_reset.c View File

@ -9,7 +9,10 @@
#include "dynamic_api.h"
#include "message_api.h"
#include "key_reset.h"
#include "key_reset_internal.h"
#include "group.h"
#include "group_internal.h"
#include "distribution_codec.h"
#include "map_asn1.h"
#include "keymanagement.h"


+ 0
- 199
src/key_reset.h View File

@ -121,205 +121,6 @@ DYNAMIC_API PEP_STATUS key_reset_all_own_keys(PEP_SESSION session);
*/
DYNAMIC_API PEP_STATUS key_reset_own_grouped_keys(PEP_SESSION session);
/**
* <!-- key_reset() -->
*
* @brief Reset the database status for a key, removing all trust information
* and default database connections. For own keys, also revoke the key
* and communicate the revocation and new key to partners we have sent
* mail to recently from the specific identity (i.e. address/user_id)
* that contacted them. We also in this case set up information so that
* if someone we mail uses the wrong key and wasn't yet contacted,
* we can send them the reset information from the right address.
* For non-own keys, also remove key from the keyring.
*
* Can be called manually or through another protocol.
*
* @param[in] session session handle
* @param[in] fpr fingerprint of key to reset. If NULL and ident is NULL,
* we reset all keys for the own user. If NULL and ident is
* an own identity, we reset the default key for that
* identity. If that own identity has no default key, we
* reset the user default.
* if it is NULL and there is a non-own identity, we will reset
* the default key for this identity if present, and user if not.
* @param[in] ident identity for which the key reset should occur.
* if NULL and fpr is non-NULL, we'll reset the key for all
* associated identities. If both ident and fpr are NULL, see
* the fpr arg documentation.
* ***IF there is an ident, it must have a user_id.***
* Note: ident->fpr is always ignored
* Caveat: this is now used in large part for internal calls.
* external apps should call key_reset_identity and key_reset_userdata
* and this function should probably be removed from the dynamic api
*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval PEP_OUT_OF_MEMORY out of memory
* @retval any other value on error
*/
PEP_STATUS key_reset(
PEP_SESSION session,
const char* fpr,
pEp_identity* ident
);
/*
PEP_STATUS key_reset_own_and_deliver_revocations(PEP_SESSION session,
identity_list** own_identities,
stringlist_t** revocations,
stringlist_t** keys);
*/
/**
* <!-- has_key_reset_been_sent() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] from_addr const char*
* @param[in] user_id const char*
* @param[in] revoked_fpr const char*
* @param[in] contacted bool*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval any other value on error
*/
PEP_STATUS has_key_reset_been_sent(
PEP_SESSION session,
const char* from_addr,
const char* user_id,
const char* revoked_fpr,
bool* contacted);
/**
* <!-- set_reset_contact_notified() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] own_address const char*
* @param[in] revoke_fpr const char*
* @param[in] contact_id const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval PEP_UNKNOWN_DB_ERROR
*/
PEP_STATUS set_reset_contact_notified(
PEP_SESSION session,
const char* own_address,
const char* revoke_fpr,
const char* contact_id
);
/**
* <!-- receive_key_reset() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] reset_msg message*
*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval PEP_OUT_OF_MEMORY out of memory
* @retval PEP_MALFORMED_KEY_RESET_MSG
* @retval PEP_KEY_NOT_RESET
* @retval PEP_UNKNOWN_ERROR
* @retval any other value on error
* */
PEP_STATUS receive_key_reset(PEP_SESSION session,
message* reset_msg);
/**
* <!-- create_standalone_key_reset_message() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] dst message**
* @param[in] own_identity pEp_identity*
* @param[in] recip pEp_identity*
* @param[in] old_fpr const char*
* @param[in] new_fpr const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval PEP_UNKNOWN_ERROR
* @retval any other value on error
*/
PEP_STATUS create_standalone_key_reset_message(PEP_SESSION session,
message** dst,
pEp_identity* own_identity,
pEp_identity* recip,
const char* old_fpr,
const char* new_fpr);
/**
* <!-- send_key_reset_to_recents() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] from_ident pEp_identity*
* @param[in] old_fpr const char*
* @param[in] new_fpr const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval PEP_SYNC_NO_MESSAGE_SEND_CALLBACK
* @retval any other value on error
*/
PEP_STATUS send_key_reset_to_recents(PEP_SESSION session,
pEp_identity* from_ident,
const char* old_fpr,
const char* new_fpr);
/**
* <!-- key_reset_commands_to_PER() -->
*
* @brief TODO
*
* @param[in] command_list const keyreset_command_list*
* @param[in] cmds char**
* @param[in] size size_t*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval any other value on error
*/
PEP_STATUS key_reset_commands_to_PER(const keyreset_command_list *command_list, char **cmds, size_t *size);
/**
* <!-- PER_to_key_reset_commands() -->
*
* @brief TODO
*
* @param[in] cmds const char*
* @param[in] size size_t
* @param[in] command_list keyreset_command_list**
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval any other value on error
*/
PEP_STATUS PER_to_key_reset_commands(const char *cmds, size_t size, keyreset_command_list **command_list);
PEP_STATUS key_reset_managed_group(PEP_SESSION session,
pEp_identity* group_identity,
pEp_identity* manager);
PEP_STATUS generate_own_commandlist_msg(PEP_SESSION session,
identity_list* reset_idents,
bool ignore_ungrouped,
pEp_identity* alt_sender,
pEp_identity* alt_recip,
const char* old_fpr,
message** dst);
#ifdef __cplusplus
}


+ 228
- 0
src/key_reset_internal.h View File

@ -0,0 +1,228 @@
/**
* @file key_reset_internal.h
* @brief Functions for resetting partner key defaults and trust and mistrusting and revoking own keys,
* as well as functions to inform partners of own revoked keys and their replacements
* @license GNU General Public License 3.0 - see LICENSE.txt
*/
#ifndef KEY_RESET_INTERNAL_H
#define KEY_RESET_INTERNAL_H
#include "pEpEngine.h"
#include "keymanagement.h"
#include "message.h"
#include "message_api.h"
#include "cryptotech.h"
#include "keyreset_command.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* <!-- key_reset() -->
*
* @brief Reset the database status for a key, removing all trust information
* and default database connections. For own keys, also revoke the key
* and communicate the revocation and new key to partners we have sent
* mail to recently from the specific identity (i.e. address/user_id)
* that contacted them. We also in this case set up information so that
* if someone we mail uses the wrong key and wasn't yet contacted,
* we can send them the reset information from the right address.
* For non-own keys, also remove key from the keyring.
*
* Can be called manually or through another protocol.
*
* @param[in] session session handle
* @param[in] fpr fingerprint of key to reset. If NULL and ident is NULL,
* we reset all keys for the own user. If NULL and ident is
* an own identity, we reset the default key for that
* identity. If that own identity has no default key, we
* reset the user default.
* if it is NULL and there is a non-own identity, we will reset
* the default key for this identity if present, and user if not.
* @param[in] ident identity for which the key reset should occur.
* if NULL and fpr is non-NULL, we'll reset the key for all
* associated identities. If both ident and fpr are NULL, see
* the fpr arg documentation.
* ***IF there is an ident, it must have a user_id.***
* Note: ident->fpr is always ignored
* Caveat: this is now used in large part for internal calls.
* external apps should call key_reset_identity and key_reset_userdata
* and this function should probably be removed from the dynamic api
*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval PEP_OUT_OF_MEMORY out of memory
* @retval any other value on error
*/
PEP_STATUS key_reset(
PEP_SESSION session,
const char* fpr,
pEp_identity* ident
);
/*
PEP_STATUS key_reset_own_and_deliver_revocations(PEP_SESSION session,
identity_list** own_identities,
stringlist_t** revocations,
stringlist_t** keys);
*/
/**
* <!-- has_key_reset_been_sent() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] from_addr const char*
* @param[in] user_id const char*
* @param[in] revoked_fpr const char*
* @param[in] contacted bool*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval any other value on error
*/
PEP_STATUS has_key_reset_been_sent(
PEP_SESSION session,
const char* from_addr,
const char* user_id,
const char* revoked_fpr,
bool* contacted);
/**
* <!-- set_reset_contact_notified() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] own_address const char*
* @param[in] revoke_fpr const char*
* @param[in] contact_id const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval PEP_UNKNOWN_DB_ERROR
*/
PEP_STATUS set_reset_contact_notified(
PEP_SESSION session,
const char* own_address,
const char* revoke_fpr,
const char* contact_id
);
/**
* <!-- receive_key_reset() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] reset_msg message*
*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval PEP_OUT_OF_MEMORY out of memory
* @retval PEP_MALFORMED_KEY_RESET_MSG
* @retval PEP_KEY_NOT_RESET
* @retval PEP_UNKNOWN_ERROR
* @retval any other value on error
* */
PEP_STATUS receive_key_reset(PEP_SESSION session,
message* reset_msg);
/**
* <!-- create_standalone_key_reset_message() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] dst message**
* @param[in] own_identity pEp_identity*
* @param[in] recip pEp_identity*
* @param[in] old_fpr const char*
* @param[in] new_fpr const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval PEP_UNKNOWN_ERROR
* @retval any other value on error
*/
PEP_STATUS create_standalone_key_reset_message(PEP_SESSION session,
message** dst,
pEp_identity* own_identity,
pEp_identity* recip,
const char* old_fpr,
const char* new_fpr);
/**
* <!-- send_key_reset_to_recents() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] from_ident pEp_identity*
* @param[in] old_fpr const char*
* @param[in] new_fpr const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval PEP_SYNC_NO_MESSAGE_SEND_CALLBACK
* @retval any other value on error
*/
PEP_STATUS send_key_reset_to_recents(PEP_SESSION session,
pEp_identity* from_ident,
const char* old_fpr,
const char* new_fpr);
/**
* <!-- key_reset_commands_to_PER() -->
*
* @brief TODO
*
* @param[in] command_list const keyreset_command_list*
* @param[in] cmds char**
* @param[in] size size_t*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval any other value on error
*/
PEP_STATUS key_reset_commands_to_PER(const keyreset_command_list *command_list, char **cmds, size_t *size);
/**
* <!-- PER_to_key_reset_commands() -->
*
* @brief TODO
*
* @param[in] cmds const char*
* @param[in] size size_t
* @param[in] command_list keyreset_command_list**
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter values
* @retval any other value on error
*/
PEP_STATUS PER_to_key_reset_commands(const char *cmds, size_t size, keyreset_command_list **command_list);
PEP_STATUS key_reset_managed_group(PEP_SESSION session,
pEp_identity* group_identity,
pEp_identity* manager);
PEP_STATUS generate_own_commandlist_msg(PEP_SESSION session,
identity_list* reset_idents,
bool ignore_ungrouped,
pEp_identity* alt_sender,
pEp_identity* alt_recip,
const char* old_fpr,
message** dst);
#ifdef __cplusplus
}
#endif
#endif

+ 2
- 0
src/message_api.c View File

@ -18,7 +18,9 @@
#include "internal_format.h"
#include "sync_codec.h"
#include "distribution_codec.h"
#include "group.h"
#include "group_internal.h"
#include <assert.h>
#include <string.h>


+ 0
- 634
src/pEpEngine.h View File

@ -915,24 +915,6 @@ DYNAMIC_API PEP_STATUS get_identity(
pEp_identity **identity
);
/**
* <!-- replace_identities_fpr() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] old_fpr const char*
* @param[in] new_fpr const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_CANNOT_SET_IDENTITY
* @retval PEP_ILLEGAL_VALUE illegal parameter values
*
*/
PEP_STATUS replace_identities_fpr(PEP_SESSION session,
const char* old_fpr,
const char* new_fpr);
/**
* <!-- set_identity() -->
@ -1196,45 +1178,6 @@ DYNAMIC_API PEP_STATUS import_key(
identity_list **private_keys
);
/**
* <!-- _import_key_with_fpr_return() -->
*
* @brief INTERNAL FUNCTION - import keys from data, return optional list
* of fprs imported
*
* @param[in] session session handle
* @param[in] key_data key data, i.e. ASCII armored OpenPGP key
* @param[in] size amount of data to handle
* @param[out] private_keys list of identities containing the
* private keys that have been imported
* @param[out] imported_keys if non-NULL, list of actual keys imported
* @param[out] changed_public_keys if non-NULL AND imported_keys is non-NULL:
* bitvector - corresponds to the first 64 keys
* imported. If nth bit is set, import changed a
* key corresponding to the nth element in
* imported keys (i.e. key was in DB and was
* changed by import)
*
* @retval PEP_KEY_IMPORTED key was successfully imported
* @retval PEP_OUT_OF_MEMORY out of memory
* @retval PEP_ILLEGAL_VALUE there is no key data to import, or imported keys was NULL and
* changed_public_keys was not
*
* @warning private_keys and imported_keys goes to the ownership of the caller
* private_keys and imported_keys can be left NULL, it is then ignored
* *** THIS IS THE ACTUAL FUNCTION IMPLEMENTED BY CRYPTOTECH "import_key" ***
*
*/
PEP_STATUS _import_key_with_fpr_return(
PEP_SESSION session,
const char *key_data,
size_t size,
identity_list** private_keys,
stringlist_t** imported_keys,
uint64_t* changed_public_keys // use as bit field for the first 64 changed keys
);
/**
* <!-- export_key() -->
@ -1417,39 +1360,6 @@ DYNAMIC_API void *pEp_realloc(void *p, size_t size);
DYNAMIC_API PEP_STATUS get_trust(PEP_SESSION session, pEp_identity *identity);
/**
* <!-- set_trust() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] identity pEp_identity*
*
* @retval PEP_STATUS_OK
* @retval any other value on error
*/
PEP_STATUS set_trust(PEP_SESSION session,
pEp_identity* identity);
/**
* <!-- update_trust_for_fpr() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] fpr const char*
* @param[in] comm_type PEP_comm_type
*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_SET_TRUST
*
*/
PEP_STATUS update_trust_for_fpr(PEP_SESSION session,
const char* fpr,
PEP_comm_type comm_type);
/**
* <!-- least_trust() -->
*
@ -1591,22 +1501,6 @@ DYNAMIC_API PEP_STATUS key_revoked(
bool *revoked
);
/**
* <!-- get_key_userids() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] fpr const char*
* @param[in] keylist stringlist_t**
*
*/
PEP_STATUS get_key_userids(
PEP_SESSION session,
const char* fpr,
stringlist_t** keylist
);
/**
* <!-- get_crashdump_log() -->
@ -1763,46 +1657,6 @@ DYNAMIC_API PEP_STATUS get_revoked(
uint64_t *revocation_date
);
/**
* <!-- key_created() -->
*
* @brief Get creation date of a key
*
* @param[in] session session handle
* @param[in] fpr fingerprint of key
* @param[out] created date of creation
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
*
*/
PEP_STATUS key_created(
PEP_SESSION session,
const char *fpr,
time_t *created
);
/**
* <!-- find_private_keys() -->
*
* @brief Find keys in keyring
*
* @param[in] session session handle
* @param[in] pattern fingerprint or address to search for as
* UTF-8 string
* @param[out] keylist list of fingerprints found or NULL on error
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
*
* @warning the ownerships of keylist isgoing to the caller
* the caller must use free_stringlist() to free it
*
*/
PEP_STATUS find_private_keys(PEP_SESSION session, const char* pattern,
stringlist_t **keylist);
/**
* <!-- get_engine_version() -->
@ -1985,26 +1839,6 @@ DYNAMIC_API PEP_STATUS set_ident_enc_format(PEP_SESSION session,
PEP_enc_format format);
/**
* <!-- _generate_keypair() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] identity pEp_identity*
* @param[in] suppress_event bool
*
* @retval PEP_STATUS_OK encryption and signing succeeded
* @retval PEP_ILLEGAL_VALUE illegal values for identity fields given
* @retval PEP_CANNOT_CREATE_KEY key engine is on strike
* @retval PEP_OUT_OF_MEMORY out of memory
* @retval any other value on error
*
*/
PEP_STATUS _generate_keypair(PEP_SESSION session,
pEp_identity *identity,
bool suppress_event);
/**
* <!-- reset_pEptest_hack() -->
*
@ -2020,194 +1854,6 @@ PEP_STATUS _generate_keypair(PEP_SESSION session,
*/
DYNAMIC_API PEP_STATUS reset_pEptest_hack(PEP_SESSION session);
// This is used internally when there is a temporary identity to be retrieved
// that may not yet have an FPR attached. See get_identity() for functionality,
// params and caveats.
/**
* <!-- get_identity_without_trust_check() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] address const char*
* @param[in] user_id const char*
* @param[in] identity pEp_identity**
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_FIND_IDENTITY
* @retval PEP_OUT_OF_MEMORY out of memory
*
*/
PEP_STATUS get_identity_without_trust_check(
PEP_SESSION session,
const char *address,
const char *user_id,
pEp_identity **identity
);
/**
* <!-- get_identities_by_address() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] address const char*
* @param[in] id_list identity_list**
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_FIND_IDENTITY
* @retval PEP_OUT_OF_MEMORY out of memory
*
*/
PEP_STATUS get_identities_by_address(
PEP_SESSION session,
const char *address,
identity_list** id_list
);
/**
* <!-- get_identities_by_userid() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] user_id const char*
* @param[in] identities identity_list**
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_FIND_IDENTITY
* @retval PEP_OUT_OF_MEMORY out of memory
*
*/
PEP_STATUS get_identities_by_userid(
PEP_SESSION session,
const char *user_id,
identity_list **identities
);
/**
* <!-- is_own_address() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] address const char*
* @param[in] is_own_addr bool*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_RECORD_NOT_FOUND
*
*/
PEP_STATUS is_own_address(PEP_SESSION session,
const char* address,
bool* is_own_addr);
/**
* <!-- replace_userid() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] old_uid const char*
* @param[in] new_uid const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_SET_PERSON
*/
PEP_STATUS replace_userid(PEP_SESSION session, const char* old_uid,
const char* new_uid);
/**
* <!-- remove_key() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] fpr const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_SET_PGP_KEYPAIR
*
*/
PEP_STATUS remove_key(PEP_SESSION session, const char* fpr);
/**
* <!-- remove_fpr_as_default() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] fpr const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_SET_IDENTITY
* @retval PEP_CANNOT_SET_PERSON
*
*/
PEP_STATUS remove_fpr_as_default(PEP_SESSION session,
const char* fpr);
/**
* <!-- get_main_user_fpr() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] user_id const char*
* @param[in] main_fpr char**
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_OUT_OF_MEMORY out of memory
* @retval PEP_KEY_NOT_FOUND
* @retval PEP_CANNOT_FIND_PERSON
*/
PEP_STATUS get_main_user_fpr(PEP_SESSION session,
const char* user_id,
char** main_fpr);
/**
* <!-- replace_main_user_fpr() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] user_id const char*
* @param[in] new_fpr const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_SET_PERSON
*
*/
PEP_STATUS replace_main_user_fpr(PEP_SESSION session, const char* user_id,
const char* new_fpr);
/**
* <!-- replace_main_user_fpr_if_equal() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] user_id const char*
* @param[in] new_fpr const char*
* @param[in] compare_fpr const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_SET_PERSON
*
*/
PEP_STATUS replace_main_user_fpr_if_equal(PEP_SESSION session, const char* user_id,
const char* new_fpr, const char* compare_fpr);
/**
* <!-- get_replacement_fpr() -->
@ -2232,20 +1878,6 @@ DYNAMIC_API PEP_STATUS get_replacement_fpr(
uint64_t *revocation_date
);
/**
* <!-- refresh_userid_default_key() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] user_id const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_SET_PERSON
*
*/
PEP_STATUS refresh_userid_default_key(PEP_SESSION session, const char* user_id);
// This ONLY sets the *user* flag, and creates a shell identity if necessary.
/**
@ -2263,273 +1895,7 @@ PEP_STATUS refresh_userid_default_key(PEP_SESSION session, const char* user_id);
*/
DYNAMIC_API PEP_STATUS set_as_pEp_user(PEP_SESSION session, pEp_identity* user);
// returns true (by reference) if a person with this user_id exists;
// Also replaces aliased user_ids by defaults in identity.
/**
* <!-- exists_person() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] identity pEp_identity*
* @param[in] exists bool*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_UNKNOWN_DB_ERROR
*/
PEP_STATUS exists_person(PEP_SESSION session, pEp_identity* identity, bool* exists);
/**
* <!-- set_pgp_keypair() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] fpr const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_SET_PGP_KEYPAIR
*/
PEP_STATUS set_pgp_keypair(PEP_SESSION session, const char* fpr);
/**
* <!-- set_pEp_version() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] ident pEp_identity*
* @param[in] new_ver_major unsigned int
* @param[in] new_ver_minor unsigned int
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_SET_PEP_VERSION
*
*/
PEP_STATUS set_pEp_version(PEP_SESSION session, pEp_identity* ident, unsigned int new_ver_major, unsigned int new_ver_minor);
/**
* <!-- clear_trust_info() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] user_id const char*
* @param[in] fpr const char*
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_UNKNOWN_ERROR
*
*/
PEP_STATUS clear_trust_info(PEP_SESSION session,
const char* user_id,
const char* fpr);
// Generally ONLY called by set_as_pEp_user, and ONLY from < 2.0 to 2.0.
/**
* <!-- upgrade_pEp_version_by_user_id() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] ident pEp_identity*
* @param[in] new_ver_major unsigned int
* @param[in] new_ver_minor unsigned int
*
* @retval PEP_STATUS_OK
* @retval PEP_ILLEGAL_VALUE illegal parameter value
* @retval PEP_CANNOT_SET_PEP_VERSION
*
*/
PEP_STATUS upgrade_pEp_version_by_user_id(PEP_SESSION session,
pEp_identity* ident,
unsigned int new_ver_major,
unsigned int new_ver_minor
);
// exposed for testing
/**
* <!-- set_person() -->
*
* @brief TODO
*
* @param[in] session session handle
* @param[in] identity pEp_identity*
* @param[in] guard_transaction bool
*
* @retval PEP_STATUS_OK
* @retval any other value on error
*/
PEP_STATUS set_person(PEP_SESSION session, pEp_identity* identity,