diff options
author | George Hazan <ghazan@miranda.im> | 2017-04-13 14:28:32 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-04-13 14:28:32 +0300 |
commit | b217f24e496c98b4f7af416ca61e67571fb6b2bf (patch) | |
tree | 45249aacc12044d051fcf37473bf848153f1d6ab /protocols/JabberG/src | |
parent | c0a6d2319296d16c632aa2a07ae553454d8e3c39 (diff) |
compilation fix + fix for line endings
Diffstat (limited to 'protocols/JabberG/src')
-rwxr-xr-x | protocols/JabberG/src/jabber_omemo.cpp | 329 |
1 files changed, 165 insertions, 164 deletions
diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp index 2c2eba4e32..30221547d4 100755 --- a/protocols/JabberG/src/jabber_omemo.cpp +++ b/protocols/JabberG/src/jabber_omemo.cpp @@ -575,16 +575,16 @@ namespace omemo { };
int load_session_func(signal_buffer **record, const signal_protocol_address *address, void *user_data)
{
- /** - * Returns a copy of the serialized session record corresponding to the - * provided recipient ID + device ID tuple. - * - * @param record pointer to a freshly allocated buffer containing the - * serialized session record. Unset if no record was found. - * The Signal Protocol library is responsible for freeing this buffer. - * @param address the address of the remote client - * @return 1 if the session was loaded, 0 if the session was not found, negative on failure - */ + /**
+ * Returns a copy of the serialized session record corresponding to the
+ * provided recipient ID + device ID tuple.
+ *
+ * @param record pointer to a freshly allocated buffer containing the
+ * serialized session record. Unset if no record was found.
+ * The Signal Protocol library is responsible for freeing this buffer.
+ * @param address the address of the remote client
+ * @return 1 if the session was loaded, 0 if the session was not found, negative on failure
+ */
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
@@ -621,7 +621,8 @@ namespace omemo { size_t name_len;
db_enum_settings_sub_cb_data(unsigned int &arr_size_) : arr_size(arr_size_)
{}
- db_enum_settings_sub_cb_data() = delete; //we always need array size
+ private:
+ db_enum_settings_sub_cb_data(); //we always need array size
};
int db_enum_settings_sub_cb(const char *szSetting, LPARAM lParam)
@@ -649,14 +650,14 @@ namespace omemo { }
int get_sub_device_sessions_func(signal_int_list **sessions, const char *name, size_t name_len, void *user_data)
{
- /** - * Returns all known devices with active sessions for a recipient - * - * @param pointer to an array that will be allocated and populated with the result - * @param name the name of the remote client - * @param name_len the length of the name - * @return size of the sessions array, or negative on failure - */ + /**
+ * Returns all known devices with active sessions for a recipient
+ *
+ * @param pointer to an array that will be allocated and populated with the result
+ * @param name the name of the remote client
+ * @param name_len the length of the name
+ * @return size of the sessions array, or negative on failure
+ */
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
signal_int_list *l = signal_int_list_alloc();
@@ -675,16 +676,16 @@ namespace omemo { int store_session_func(const signal_protocol_address *address, uint8_t *record, size_t record_len, void *user_data)
{
- /** - * Commit to storage the session record for a given - * recipient ID + device ID tuple. - * - * @param address the address of the remote client - * @param record pointer to a buffer containing the serialized session - * record for the remote client - * @param record_len length of the serialized session record - * @return 0 on success, negative on failure - */ + /**
+ * Commit to storage the session record for a given
+ * recipient ID + device ID tuple.
+ *
+ * @param address the address of the remote client
+ * @param record pointer to a buffer containing the serialized session
+ * record for the remote client
+ * @param record_len length of the serialized session record
+ * @return 0 on success, negative on failure
+ */
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
char *id_buf = (char*)mir_alloc(address->name_len + sizeof(int32_t));
@@ -705,13 +706,13 @@ namespace omemo { int contains_session_func(const signal_protocol_address *address, void *user_data)
{
- /** - * Determine whether there is a committed session record for a - * recipient ID + device ID tuple. - * - * @param address the address of the remote client - * @return 1 if a session record exists, 0 otherwise. - */ + /**
+ * Determine whether there is a committed session record for a
+ * recipient ID + device ID tuple.
+ *
+ * @param address the address of the remote client
+ * @return 1 if a session record exists, 0 otherwise.
+ */
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
char *id_buf = (char*)mir_alloc(address->name_len + sizeof(int32_t));
@@ -740,12 +741,12 @@ namespace omemo { int delete_session_func(const signal_protocol_address *address, void *user_data)
{
- /** - * Remove a session record for a recipient ID + device ID tuple. - * - * @param address the address of the remote client - * @return 1 if a session was deleted, 0 if a session was not deleted, negative on error - */ + /**
+ * Remove a session record for a recipient ID + device ID tuple.
+ *
+ * @param address the address of the remote client
+ * @return 1 if a session was deleted, 0 if a session was not deleted, negative on error
+ */
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
@@ -789,14 +790,14 @@ namespace omemo { }
int delete_all_sessions_func(const char *name, size_t name_len, void *user_data)
{
- /** - * Remove the session records corresponding to all devices of a recipient ID. - * - * @param name the name of the remote client - * @param name_len the length of the name - * @return the number of deleted sessions on success, negative on failure - */ - + /**
+ * Remove the session records corresponding to all devices of a recipient ID.
+ *
+ * @param name the name of the remote client
+ * @param name_len the length of the name
+ * @return the number of deleted sessions on success, negative on failure
+ */
+
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
db_enum_settings_del_all_cb_data *ud = (db_enum_settings_del_all_cb_data*)mir_alloc(sizeof(db_enum_settings_del_all_cb_data));
ud->user_data = data;
@@ -827,16 +828,16 @@ namespace omemo { //signal_protocol_pre_key_store callback follow
int load_pre_key(signal_buffer **record, uint32_t pre_key_id, void *user_data)
{
- /** - * Load a local serialized PreKey record. - * - * @param record pointer to a newly allocated buffer containing the record, - * if found. Unset if no record was found. - * The Signal Protocol library is responsible for freeing this buffer. - * @param pre_key_id the ID of the local serialized PreKey record - * @retval SG_SUCCESS if the key was found - * @retval SG_ERR_INVALID_KEY_ID if the key could not be found - */ + /**
+ * Load a local serialized PreKey record.
+ *
+ * @param record pointer to a newly allocated buffer containing the record,
+ * if found. Unset if no record was found.
+ * The Signal Protocol library is responsible for freeing this buffer.
+ * @param pre_key_id the ID of the local serialized PreKey record
+ * @retval SG_SUCCESS if the key was found
+ * @retval SG_ERR_INVALID_KEY_ID if the key could not be found
+ */
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
@@ -858,14 +859,14 @@ namespace omemo { int store_pre_key(uint32_t pre_key_id, uint8_t *record, size_t record_len, void *user_data)
{
- /** - * Store a local serialized PreKey record. - * - * @param pre_key_id the ID of the PreKey record to store. - * @param record pointer to a buffer containing the serialized record - * @param record_len length of the serialized record - * @return 0 on success, negative on failure - */ + /**
+ * Store a local serialized PreKey record.
+ *
+ * @param pre_key_id the ID of the PreKey record to store.
+ * @param record pointer to a buffer containing the serialized record
+ * @param record_len length of the serialized record
+ * @return 0 on success, negative on failure
+ */
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
@@ -879,13 +880,13 @@ namespace omemo { int contains_pre_key(uint32_t pre_key_id, void *user_data)
{
- /** - * Determine whether there is a committed PreKey record matching the - * provided ID. - * - * @param pre_key_id A PreKey record ID. - * @return 1 if the store has a record for the PreKey ID, 0 otherwise - */ + /**
+ * Determine whether there is a committed PreKey record matching the
+ * provided ID.
+ *
+ * @param pre_key_id A PreKey record ID.
+ * @return 1 if the store has a record for the PreKey ID, 0 otherwise
+ */
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
@@ -907,12 +908,12 @@ namespace omemo { int remove_pre_key(uint32_t pre_key_id, void *user_data)
{
- /** - * Delete a PreKey record from local storage. - * - * @param pre_key_id The ID of the PreKey record to remove. - * @return 0 on success, negative on failure - */ + /**
+ * Delete a PreKey record from local storage.
+ *
+ * @param pre_key_id The ID of the PreKey record to remove.
+ * @return 0 on success, negative on failure
+ */
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
@@ -929,16 +930,16 @@ namespace omemo { int load_signed_pre_key(signal_buffer **record, uint32_t signed_pre_key_id, void *user_data)
{
- /** - * Load a local serialized signed PreKey record. - * - * @param record pointer to a newly allocated buffer containing the record, - * if found. Unset if no record was found. - * The Signal Protocol library is responsible for freeing this buffer. - * @param signed_pre_key_id the ID of the local signed PreKey record - * @retval SG_SUCCESS if the key was found - * @retval SG_ERR_INVALID_KEY_ID if the key could not be found - */ + /**
+ * Load a local serialized signed PreKey record.
+ *
+ * @param record pointer to a newly allocated buffer containing the record,
+ * if found. Unset if no record was found.
+ * The Signal Protocol library is responsible for freeing this buffer.
+ * @param signed_pre_key_id the ID of the local signed PreKey record
+ * @retval SG_SUCCESS if the key was found
+ * @retval SG_ERR_INVALID_KEY_ID if the key could not be found
+ */
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
@@ -961,16 +962,16 @@ namespace omemo { int store_signed_pre_key(uint32_t signed_pre_key_id, uint8_t *record, size_t record_len, void *user_data)
{
- /** - * Store a local serialized signed PreKey record. - * - * @param signed_pre_key_id the ID of the signed PreKey record to store - * @param record pointer to a buffer containing the serialized record - * @param record_len length of the serialized record - * @return 0 on success, negative on failure - */ - - signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data; + /**
+ * Store a local serialized signed PreKey record.
+ *
+ * @param signed_pre_key_id the ID of the signed PreKey record to store
+ * @param record pointer to a buffer containing the serialized record
+ * @param record_len length of the serialized record
+ * @return 0 on success, negative on failure
+ */
+
+ signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
char *setting_name = (char*)mir_alloc(strlen("OmemoSignalSignedPreKey_") + 32);
mir_snprintf(setting_name, strlen("OmemoSignalSignedPreKey_") + 31, "%s%d", "OmemoSignalSignedPreKey_", signed_pre_key_id);
@@ -982,13 +983,13 @@ namespace omemo { int contains_signed_pre_key(uint32_t signed_pre_key_id, void *user_data)
{
- /** - * Determine whether there is a committed signed PreKey record matching - * the provided ID. - * - * @param signed_pre_key_id A signed PreKey record ID. - * @return 1 if the store has a record for the signed PreKey ID, 0 otherwise - */ + /**
+ * Determine whether there is a committed signed PreKey record matching
+ * the provided ID.
+ *
+ * @param signed_pre_key_id A signed PreKey record ID.
+ * @return 1 if the store has a record for the signed PreKey ID, 0 otherwise
+ */
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
@@ -1010,12 +1011,12 @@ namespace omemo { int remove_signed_pre_key(uint32_t signed_pre_key_id, void *user_data)
{
- /** - * Delete a SignedPreKeyRecord from local storage. - * - * @param signed_pre_key_id The ID of the signed PreKey record to remove. - * @return 0 on success, negative on failure - */ + /**
+ * Delete a SignedPreKeyRecord from local storage.
+ *
+ * @param signed_pre_key_id The ID of the signed PreKey record to remove.
+ * @return 0 on success, negative on failure
+ */
signal_store_backend_user_data* data = (signal_store_backend_user_data*)user_data;
@@ -1033,17 +1034,17 @@ namespace omemo { int get_identity_key_pair(signal_buffer **public_data, signal_buffer **private_data, void *user_data)
{
- /** - * Get the local client's identity key pair. - * - * @param public_data pointer to a newly allocated buffer containing the - * public key, if found. Unset if no record was found. - * The Signal Protocol library is responsible for freeing this buffer. - * @param private_data pointer to a newly allocated buffer containing the - * private key, if found. Unset if no record was found. - * The Signal Protocol library is responsible for freeing this buffer. - * @return 0 on success, negative on failure - */ + /**
+ * Get the local client's identity key pair.
+ *
+ * @param public_data pointer to a newly allocated buffer containing the
+ * public key, if found. Unset if no record was found.
+ * The Signal Protocol library is responsible for freeing this buffer.
+ * @param private_data pointer to a newly allocated buffer containing the
+ * private key, if found. Unset if no record was found.
+ * The Signal Protocol library is responsible for freeing this buffer.
+ * @return 0 on success, negative on failure
+ */
//TODO:
return -1; //failure
@@ -1051,16 +1052,16 @@ namespace omemo { int get_local_registration_id(void *user_data, uint32_t *registration_id)
{
- /** - * Return the local client's registration ID. - * - * Clients should maintain a registration ID, a random number - * between 1 and 16380 that's generated once at install time. - * - * @param registration_id pointer to be set to the local client's - * registration ID, if it was successfully retrieved. - * @return 0 on success, negative on failure - */ + /**
+ * Return the local client's registration ID.
+ *
+ * Clients should maintain a registration ID, a random number
+ * between 1 and 16380 that's generated once at install time.
+ *
+ * @param registration_id pointer to be set to the local client's
+ * registration ID, if it was successfully retrieved.
+ * @return 0 on success, negative on failure
+ */
//TODO:
return -1; //failure
@@ -1068,19 +1069,19 @@ namespace omemo { int save_identity(const signal_protocol_address *address, uint8_t *key_data, size_t key_len, void *user_data)
{
- /** - * Save a remote client's identity key - * <p> - * Store a remote client's identity key as trusted. - * The value of key_data may be null. In this case remove the key data - * from the identity store, but retain any metadata that may be kept - * alongside it. - * - * @param address the address of the remote client - * @param key_data Pointer to the remote client's identity key, may be null - * @param key_len Length of the remote client's identity key - * @return 0 on success, negative on failure - */ + /**
+ * Save a remote client's identity key
+ * <p>
+ * Store a remote client's identity key as trusted.
+ * The value of key_data may be null. In this case remove the key data
+ * from the identity store, but retain any metadata that may be kept
+ * alongside it.
+ *
+ * @param address the address of the remote client
+ * @param key_data Pointer to the remote client's identity key, may be null
+ * @param key_len Length of the remote client's identity key
+ * @return 0 on success, negative on failure
+ */
//TODO:
return -1; //failure
@@ -1088,22 +1089,22 @@ namespace omemo { int is_trusted_identity(const signal_protocol_address *address, uint8_t *key_data, size_t key_len, void *user_data)
{
- /** - * Verify a remote client's identity key. - * - * Determine whether a remote client's identity is trusted. Convention is - * that the TextSecure protocol is 'trust on first use.' This means that - * an identity key is considered 'trusted' if there is no entry for the recipient - * in the local store, or if it matches the saved key for a recipient in the local - * store. Only if it mismatches an entry in the local store is it considered - * 'untrusted.' - * - * @param address the address of the remote client - * @param identityKey The identity key to verify. - * @param key_data Pointer to the identity key to verify - * @param key_len Length of the identity key to verify - * @return 1 if trusted, 0 if untrusted, negative on failure - */ + /**
+ * Verify a remote client's identity key.
+ *
+ * Determine whether a remote client's identity is trusted. Convention is
+ * that the TextSecure protocol is 'trust on first use.' This means that
+ * an identity key is considered 'trusted' if there is no entry for the recipient
+ * in the local store, or if it matches the saved key for a recipient in the local
+ * store. Only if it mismatches an entry in the local store is it considered
+ * 'untrusted.'
+ *
+ * @param address the address of the remote client
+ * @param identityKey The identity key to verify.
+ * @param key_data Pointer to the identity key to verify
+ * @param key_len Length of the identity key to verify
+ * @return 1 if trusted, 0 if untrusted, negative on failure
+ */
//TODO:
return -1; //failure
|