Apply coding style

Regards https://github.com/profanity-im/profanity/issues/1396
This commit is contained in:
Michael Vetter
2020-07-07 09:43:28 +02:00
parent 66f9a6b721
commit 9b55f2dec0
214 changed files with 19572 additions and 17582 deletions

View File

@@ -33,13 +33,13 @@
*
*/
#include <assert.h>
#include <gcrypt.h>
#include <signal/signal_protocol.h>
#include <signal/signal_protocol_types.h>
#include <gcrypt.h>
#include "log.h"
#include "omemo/omemo.h"
#include "omemo/crypto.h"
#include "omemo/omemo.h"
int
omemo_crypto_init(void)
@@ -65,14 +65,14 @@ omemo_crypto_init(void)
}
int
omemo_random_func(uint8_t *data, size_t len, void *user_data)
omemo_random_func(uint8_t* data, size_t len, void* user_data)
{
gcry_randomize(data, len, GCRY_VERY_STRONG_RANDOM);
return 0;
}
int
omemo_hmac_sha256_init_func(void **hmac_context, const uint8_t *key, size_t key_len, void *user_data)
omemo_hmac_sha256_init_func(void** hmac_context, const uint8_t* key, size_t key_len, void* user_data)
{
gcry_error_t res;
gcry_mac_hd_t hd;
@@ -94,7 +94,7 @@ omemo_hmac_sha256_init_func(void **hmac_context, const uint8_t *key, size_t key_
}
int
omemo_hmac_sha256_update_func(void *hmac_context, const uint8_t *data, size_t data_len, void *user_data)
omemo_hmac_sha256_update_func(void* hmac_context, const uint8_t* data, size_t data_len, void* user_data)
{
gcry_error_t res;
@@ -108,7 +108,7 @@ omemo_hmac_sha256_update_func(void *hmac_context, const uint8_t *data, size_t da
}
int
omemo_hmac_sha256_final_func(void *hmac_context, signal_buffer **output, void *user_data)
omemo_hmac_sha256_final_func(void* hmac_context, signal_buffer** output, void* user_data)
{
gcry_error_t res;
size_t mac_len = 32;
@@ -125,13 +125,13 @@ omemo_hmac_sha256_final_func(void *hmac_context, signal_buffer **output, void *u
}
void
omemo_hmac_sha256_cleanup_func(void *hmac_context, void *user_data)
omemo_hmac_sha256_cleanup_func(void* hmac_context, void* user_data)
{
gcry_mac_close(hmac_context);
}
int
omemo_sha512_digest_init_func(void **digest_context, void *user_data)
omemo_sha512_digest_init_func(void** digest_context, void* user_data)
{
gcry_error_t res;
gcry_md_hd_t hd;
@@ -148,7 +148,7 @@ omemo_sha512_digest_init_func(void **digest_context, void *user_data)
}
int
omemo_sha512_digest_update_func(void *digest_context, const uint8_t *data, size_t data_len, void *user_data)
omemo_sha512_digest_update_func(void* digest_context, const uint8_t* data, size_t data_len, void* user_data)
{
gcry_md_write(digest_context, data, data_len);
@@ -156,7 +156,7 @@ omemo_sha512_digest_update_func(void *digest_context, const uint8_t *data, size_
}
int
omemo_sha512_digest_final_func(void *digest_context, signal_buffer **output, void *user_data)
omemo_sha512_digest_final_func(void* digest_context, signal_buffer** output, void* user_data)
{
gcry_error_t res;
unsigned char out[64];
@@ -172,37 +172,37 @@ omemo_sha512_digest_final_func(void *digest_context, signal_buffer **output, voi
}
void
omemo_sha512_digest_cleanup_func(void *digest_context, void *user_data)
omemo_sha512_digest_cleanup_func(void* digest_context, void* user_data)
{
gcry_md_close(digest_context);
}
int
omemo_encrypt_func(signal_buffer **output, int cipher, const uint8_t *key, size_t key_len, const uint8_t *iv, size_t iv_len,
const uint8_t *plaintext, size_t plaintext_len, void *user_data)
omemo_encrypt_func(signal_buffer** output, int cipher, const uint8_t* key, size_t key_len, const uint8_t* iv, size_t iv_len,
const uint8_t* plaintext, size_t plaintext_len, void* user_data)
{
gcry_cipher_hd_t hd;
unsigned char *padded_plaintext;
unsigned char *ciphertext;
unsigned char* padded_plaintext;
unsigned char* ciphertext;
size_t ciphertext_len;
int mode;
int algo;
uint8_t padding = 0;
switch (key_len) {
case 32:
algo = GCRY_CIPHER_AES256;
break;
default:
return OMEMO_ERR_UNSUPPORTED_CRYPTO;
case 32:
algo = GCRY_CIPHER_AES256;
break;
default:
return OMEMO_ERR_UNSUPPORTED_CRYPTO;
}
switch (cipher) {
case SG_CIPHER_AES_CBC_PKCS5:
mode = GCRY_CIPHER_MODE_CBC;
break;
default:
return OMEMO_ERR_UNSUPPORTED_CRYPTO;
case SG_CIPHER_AES_CBC_PKCS5:
mode = GCRY_CIPHER_MODE_CBC;
break;
default:
return OMEMO_ERR_UNSUPPORTED_CRYPTO;
}
gcry_cipher_open(&hd, algo, mode, GCRY_CIPHER_SECURE);
@@ -210,12 +210,12 @@ omemo_encrypt_func(signal_buffer **output, int cipher, const uint8_t *key, size_
gcry_cipher_setkey(hd, key, key_len);
switch (cipher) {
case SG_CIPHER_AES_CBC_PKCS5:
gcry_cipher_setiv(hd, iv, iv_len);
padding = 16 - (plaintext_len % 16);
break;
default:
assert(FALSE);
case SG_CIPHER_AES_CBC_PKCS5:
gcry_cipher_setiv(hd, iv, iv_len);
padding = 16 - (plaintext_len % 16);
break;
default:
assert(FALSE);
}
padded_plaintext = malloc(plaintext_len + padding);
@@ -236,31 +236,31 @@ omemo_encrypt_func(signal_buffer **output, int cipher, const uint8_t *key, size_
}
int
omemo_decrypt_func(signal_buffer **output, int cipher, const uint8_t *key, size_t key_len, const uint8_t *iv, size_t iv_len,
const uint8_t *ciphertext, size_t ciphertext_len, void *user_data)
omemo_decrypt_func(signal_buffer** output, int cipher, const uint8_t* key, size_t key_len, const uint8_t* iv, size_t iv_len,
const uint8_t* ciphertext, size_t ciphertext_len, void* user_data)
{
int ret = SG_SUCCESS;
gcry_cipher_hd_t hd;
unsigned char *plaintext;
unsigned char* plaintext;
size_t plaintext_len;
int mode;
int algo;
uint8_t padding = 0;
switch (key_len) {
case 32:
algo = GCRY_CIPHER_AES256;
break;
default:
return OMEMO_ERR_UNSUPPORTED_CRYPTO;
case 32:
algo = GCRY_CIPHER_AES256;
break;
default:
return OMEMO_ERR_UNSUPPORTED_CRYPTO;
}
switch (cipher) {
case SG_CIPHER_AES_CBC_PKCS5:
mode = GCRY_CIPHER_MODE_CBC;
break;
default:
return OMEMO_ERR_UNSUPPORTED_CRYPTO;
case SG_CIPHER_AES_CBC_PKCS5:
mode = GCRY_CIPHER_MODE_CBC;
break;
default:
return OMEMO_ERR_UNSUPPORTED_CRYPTO;
}
gcry_cipher_open(&hd, algo, mode, GCRY_CIPHER_SECURE);
@@ -268,11 +268,11 @@ omemo_decrypt_func(signal_buffer **output, int cipher, const uint8_t *key, size_
gcry_cipher_setkey(hd, key, key_len);
switch (cipher) {
case SG_CIPHER_AES_CBC_PKCS5:
gcry_cipher_setiv(hd, iv, iv_len);
break;
default:
assert(FALSE);
case SG_CIPHER_AES_CBC_PKCS5:
gcry_cipher_setiv(hd, iv, iv_len);
break;
default:
assert(FALSE);
}
plaintext_len = ciphertext_len;
@@ -280,11 +280,11 @@ omemo_decrypt_func(signal_buffer **output, int cipher, const uint8_t *key, size_
gcry_cipher_decrypt(hd, plaintext, plaintext_len, ciphertext, ciphertext_len);
switch (cipher) {
case SG_CIPHER_AES_CBC_PKCS5:
padding = plaintext[plaintext_len - 1];
break;
default:
assert(FALSE);
case SG_CIPHER_AES_CBC_PKCS5:
padding = plaintext[plaintext_len - 1];
break;
default:
assert(FALSE);
}
int i;
@@ -306,7 +306,7 @@ out:
}
int
aes128gcm_encrypt(unsigned char *ciphertext, size_t *ciphertext_len, unsigned char *tag, size_t *tag_len, const unsigned char *const plaintext, size_t plaintext_len, const unsigned char *const iv, const unsigned char *const key)
aes128gcm_encrypt(unsigned char* ciphertext, size_t* ciphertext_len, unsigned char* tag, size_t* tag_len, const unsigned char* const plaintext, size_t plaintext_len, const unsigned char* const iv, const unsigned char* const key)
{
gcry_error_t res;
gcry_cipher_hd_t hd;
@@ -340,7 +340,7 @@ out:
}
int
aes128gcm_decrypt(unsigned char *plaintext, size_t *plaintext_len, const unsigned char *const ciphertext, size_t ciphertext_len, const unsigned char *const iv, size_t iv_len, const unsigned char *const key, const unsigned char *const tag)
aes128gcm_decrypt(unsigned char* plaintext, size_t* plaintext_len, const unsigned char* const ciphertext, size_t ciphertext_len, const unsigned char* const iv, size_t iv_len, const unsigned char* const key, const unsigned char* const tag)
{
gcry_error_t res;
gcry_cipher_hd_t hd;

View File

@@ -35,7 +35,7 @@
#include <signal/signal_protocol_types.h>
#define AES128_GCM_KEY_LENGTH 16
#define AES128_GCM_IV_LENGTH 12
#define AES128_GCM_IV_LENGTH 12
#define AES128_GCM_TAG_LENGTH 16
int omemo_crypto_init(void);
@@ -47,7 +47,7 @@ int omemo_crypto_init(void);
* @param len size of the output buffer
* @return 0 on success, negative on failure
*/
int omemo_random_func(uint8_t *data, size_t len, void *user_data);
int omemo_random_func(uint8_t* data, size_t len, void* user_data);
/**
* Callback for an HMAC-SHA256 implementation.
@@ -58,7 +58,7 @@ int omemo_random_func(uint8_t *data, size_t len, void *user_data);
* @param key_len length of the key
* @return 0 on success, negative on failure
*/
int omemo_hmac_sha256_init_func(void **hmac_context, const uint8_t *key, size_t key_len, void *user_data);
int omemo_hmac_sha256_init_func(void** hmac_context, const uint8_t* key, size_t key_len, void* user_data);
/**
* Callback for an HMAC-SHA256 implementation.
@@ -69,7 +69,7 @@ int omemo_hmac_sha256_init_func(void **hmac_context, const uint8_t *key, size_t
* @param data_len length of the data
* @return 0 on success, negative on failure
*/
int omemo_hmac_sha256_update_func(void *hmac_context, const uint8_t *data, size_t data_len, void *user_data);
int omemo_hmac_sha256_update_func(void* hmac_context, const uint8_t* data, size_t data_len, void* user_data);
/**
* Callback for an HMAC-SHA256 implementation.
@@ -80,7 +80,7 @@ int omemo_hmac_sha256_update_func(void *hmac_context, const uint8_t *data, size_
* @param output buffer to be allocated and populated with the result
* @return 0 on success, negative on failure
*/
int omemo_hmac_sha256_final_func(void *hmac_context, signal_buffer **output, void *user_data);
int omemo_hmac_sha256_final_func(void* hmac_context, signal_buffer** output, void* user_data);
/**
* Callback for an HMAC-SHA256 implementation.
@@ -89,7 +89,7 @@ int omemo_hmac_sha256_final_func(void *hmac_context, signal_buffer **output, voi
*
* @param hmac_context private HMAC context pointer
*/
void omemo_hmac_sha256_cleanup_func(void *hmac_context, void *user_data);
void omemo_hmac_sha256_cleanup_func(void* hmac_context, void* user_data);
/**
* Callback for a SHA512 message digest implementation.
@@ -98,7 +98,7 @@ void omemo_hmac_sha256_cleanup_func(void *hmac_context, void *user_data);
* @param digest_context private digest context pointer
* @return 0 on success, negative on failure
*/
int omemo_sha512_digest_init_func(void **digest_context, void *user_data);
int omemo_sha512_digest_init_func(void** digest_context, void* user_data);
/**
* Callback for a SHA512 message digest implementation.
@@ -109,7 +109,7 @@ int omemo_sha512_digest_init_func(void **digest_context, void *user_data);
* @param data_len length of the data
* @return 0 on success, negative on failure
*/
int omemo_sha512_digest_update_func(void *digest_context, const uint8_t *data, size_t data_len, void *user_data);
int omemo_sha512_digest_update_func(void* digest_context, const uint8_t* data, size_t data_len, void* user_data);
/**
* Callback for a SHA512 message digest implementation.
@@ -120,7 +120,7 @@ int omemo_sha512_digest_update_func(void *digest_context, const uint8_t *data, s
* @param output buffer to be allocated and populated with the result
* @return 0 on success, negative on failure
*/
int omemo_sha512_digest_final_func(void *digest_context, signal_buffer **output, void *user_data);
int omemo_sha512_digest_final_func(void* digest_context, signal_buffer** output, void* user_data);
/**
* Callback for a SHA512 message digest implementation.
@@ -129,7 +129,7 @@ int omemo_sha512_digest_final_func(void *digest_context, signal_buffer **output,
*
* @param digest_context private digest context pointer
*/
void omemo_sha512_digest_cleanup_func(void *digest_context, void *user_data);
void omemo_sha512_digest_cleanup_func(void* digest_context, void* user_data);
/**
* Callback for an AES encryption implementation.
@@ -144,12 +144,12 @@ void omemo_sha512_digest_cleanup_func(void *digest_context, void *user_data);
* @param plaintext_len length of the plaintext
* @return 0 on success, negative on failure
*/
int omemo_encrypt_func(signal_buffer **output,
int cipher,
const uint8_t *key, size_t key_len,
const uint8_t *iv, size_t iv_len,
const uint8_t *plaintext, size_t plaintext_len,
void *user_data);
int omemo_encrypt_func(signal_buffer** output,
int cipher,
const uint8_t* key, size_t key_len,
const uint8_t* iv, size_t iv_len,
const uint8_t* plaintext, size_t plaintext_len,
void* user_data);
/**
* Callback for an AES decryption implementation.
@@ -164,19 +164,19 @@ int omemo_encrypt_func(signal_buffer **output,
* @param ciphertext_len length of the ciphertext
* @return 0 on success, negative on failure
*/
int omemo_decrypt_func(signal_buffer **output,
int cipher,
const uint8_t *key, size_t key_len,
const uint8_t *iv, size_t iv_len,
const uint8_t *ciphertext, size_t ciphertext_len,
void *user_data);
int omemo_decrypt_func(signal_buffer** output,
int cipher,
const uint8_t* key, size_t key_len,
const uint8_t* iv, size_t iv_len,
const uint8_t* ciphertext, size_t ciphertext_len,
void* user_data);
int aes128gcm_encrypt(unsigned char *ciphertext, size_t *ciphertext_len,
unsigned char *tag, size_t *tag_len,
const unsigned char *const plaintext, size_t plaintext_len,
const unsigned char *const iv, const unsigned char *const key);
int aes128gcm_encrypt(unsigned char* ciphertext, size_t* ciphertext_len,
unsigned char* tag, size_t* tag_len,
const unsigned char* const plaintext, size_t plaintext_len,
const unsigned char* const iv, const unsigned char* const key);
int aes128gcm_decrypt(unsigned char *plaintext,
size_t *plaintext_len, const unsigned char *const ciphertext,
size_t ciphertext_len, const unsigned char *const iv, size_t iv_len,
const unsigned char *const key, const unsigned char *const tag);
int aes128gcm_decrypt(unsigned char* plaintext,
size_t* plaintext_len, const unsigned char* const ciphertext,
size_t ciphertext_len, const unsigned char* const iv, size_t iv_len,
const unsigned char* const key, const unsigned char* const tag);

File diff suppressed because it is too large Load Diff

View File

@@ -34,11 +34,11 @@
*/
#include <glib.h>
#include "ui/ui.h"
#include "config/account.h"
#include "ui/ui.h"
#define OMEMO_ERR_UNSUPPORTED_CRYPTO -10000
#define OMEMO_ERR_GCRYPT -20000
#define OMEMO_ERR_GCRYPT -20000
typedef enum {
PROF_OMEMOPOLICY_MANUAL,
@@ -48,8 +48,9 @@ typedef enum {
typedef struct omemo_context_t omemo_context;
typedef struct omemo_key {
unsigned char *data;
typedef struct omemo_key
{
unsigned char* data;
size_t length;
gboolean prekey;
uint32_t device_id;
@@ -58,39 +59,39 @@ typedef struct omemo_key {
void omemo_init(void);
void omemo_close(void);
void omemo_on_connect(ProfAccount *account);
void omemo_on_connect(ProfAccount* account);
void omemo_on_disconnect(void);
void omemo_generate_crypto_materials(ProfAccount *account);
void omemo_key_free(omemo_key_t *key);
void omemo_generate_crypto_materials(ProfAccount* account);
void omemo_key_free(omemo_key_t* key);
void omemo_publish_crypto_materials(void);
uint32_t omemo_device_id(void);
void omemo_identity_key(unsigned char **output, size_t *length);
void omemo_signed_prekey(unsigned char **output, size_t *length);
void omemo_signed_prekey_signature(unsigned char **output, size_t *length);
void omemo_prekeys(GList **prekeys, GList **ids, GList **lengths);
void omemo_set_device_list(const char *const jid, GList * device_list);
GKeyFile *omemo_identity_keyfile(void);
void omemo_identity_key(unsigned char** output, size_t* length);
void omemo_signed_prekey(unsigned char** output, size_t* length);
void omemo_signed_prekey_signature(unsigned char** output, size_t* length);
void omemo_prekeys(GList** prekeys, GList** ids, GList** lengths);
void omemo_set_device_list(const char* const jid, GList* device_list);
GKeyFile* omemo_identity_keyfile(void);
void omemo_identity_keyfile_save(void);
GKeyFile *omemo_trust_keyfile(void);
GKeyFile* omemo_trust_keyfile(void);
void omemo_trust_keyfile_save(void);
GKeyFile *omemo_sessions_keyfile(void);
GKeyFile* omemo_sessions_keyfile(void);
void omemo_sessions_keyfile_save(void);
char *omemo_format_fingerprint(const char *const fingerprint);
char *omemo_own_fingerprint(gboolean formatted);
void omemo_trust(const char *const jid, const char *const fingerprint);
void omemo_untrust(const char *const jid, const char *const fingerprint);
GList *omemo_known_device_identities(const char *const jid);
gboolean omemo_is_trusted_identity(const char *const jid, const char *const fingerprint);
char *omemo_fingerprint_autocomplete(const char *const search_str, gboolean previous, void *context);
char* omemo_format_fingerprint(const char* const fingerprint);
char* omemo_own_fingerprint(gboolean formatted);
void omemo_trust(const char* const jid, const char* const fingerprint);
void omemo_untrust(const char* const jid, const char* const fingerprint);
GList* omemo_known_device_identities(const char* const jid);
gboolean omemo_is_trusted_identity(const char* const jid, const char* const fingerprint);
char* omemo_fingerprint_autocomplete(const char* const search_str, gboolean previous, void* context);
void omemo_fingerprint_autocomplete_reset(void);
gboolean omemo_automatic_start(const char *const recipient);
gboolean omemo_automatic_start(const char* const recipient);
void omemo_start_sessions(void);
void omemo_start_session(const char *const barejid);
void omemo_start_muc_sessions(const char *const roomjid);
void omemo_start_device_session(const char *const jid, uint32_t device_id, GList *prekeys, uint32_t signed_prekey_id, const unsigned char *const signed_prekey, size_t signed_prekey_len, const unsigned char *const signature, size_t signature_len, const unsigned char *const identity_key, size_t identity_key_len);
void omemo_start_session(const char* const barejid);
void omemo_start_muc_sessions(const char* const roomjid);
void omemo_start_device_session(const char* const jid, uint32_t device_id, GList* prekeys, uint32_t signed_prekey_id, const unsigned char* const signed_prekey, size_t signed_prekey_len, const unsigned char* const signature, size_t signature_len, const unsigned char* const identity_key, size_t identity_key_len);
gboolean omemo_loaded(void);
char * omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_receipt, gboolean muc, const char *const replace_id);
char * omemo_on_message_recv(const char *const from, uint32_t sid, const unsigned char *const iv, size_t iv_len, GList *keys, const unsigned char *const payload, size_t payload_len, gboolean muc, gboolean *trusted);
char* omemo_on_message_send(ProfWin* win, const char* const message, gboolean request_receipt, gboolean muc, const char* const replace_id);
char* omemo_on_message_recv(const char* const from, uint32_t sid, const unsigned char* const iv, size_t iv_len, GList* keys, const unsigned char* const payload, size_t payload_len, gboolean muc, gboolean* trusted);

View File

@@ -39,28 +39,28 @@
#include "omemo/omemo.h"
#include "omemo/store.h"
static void _g_hash_table_free(GHashTable *hash_table);
static void _g_hash_table_free(GHashTable* hash_table);
GHashTable *
GHashTable*
session_store_new(void)
{
return g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)_g_hash_table_free);
}
GHashTable *
GHashTable*
pre_key_store_new(void)
{
return g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)signal_buffer_free);
}
GHashTable *
GHashTable*
signed_pre_key_store_new(void)
{
return g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)signal_buffer_free);
}
void
identity_key_store_new(identity_key_store_t *identity_key_store)
identity_key_store_new(identity_key_store_t* identity_key_store)
{
identity_key_store->trusted = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)signal_buffer_free);
identity_key_store->private = NULL;
@@ -69,16 +69,16 @@ identity_key_store_new(identity_key_store_t *identity_key_store)
#ifdef HAVE_LIBSIGNAL_LT_2_3_2
int
load_session(signal_buffer **record, const signal_protocol_address *address,
void *user_data)
load_session(signal_buffer** record, const signal_protocol_address* address,
void* user_data)
#else
int
load_session(signal_buffer **record, signal_buffer **user_record,
const signal_protocol_address *address, void *user_data)
load_session(signal_buffer** record, signal_buffer** user_record,
const signal_protocol_address* address, void* user_data)
#endif
{
GHashTable *session_store = (GHashTable *)user_data;
GHashTable *device_store = NULL;
GHashTable* session_store = (GHashTable*)user_data;
GHashTable* device_store = NULL;
device_store = g_hash_table_lookup(session_store, address->name);
if (!device_store) {
@@ -86,7 +86,7 @@ load_session(signal_buffer **record, signal_buffer **user_record,
return 0;
}
signal_buffer *original = g_hash_table_lookup(device_store, GINT_TO_POINTER(address->device_id));
signal_buffer* original = g_hash_table_lookup(device_store, GINT_TO_POINTER(address->device_id));
if (!original) {
*record = NULL;
return 0;
@@ -96,11 +96,11 @@ load_session(signal_buffer **record, signal_buffer **user_record,
}
int
get_sub_device_sessions(signal_int_list **sessions, const char *name,
size_t name_len, void *user_data)
get_sub_device_sessions(signal_int_list** sessions, const char* name,
size_t name_len, void* user_data)
{
GHashTable *session_store = (GHashTable *)user_data;
GHashTable *device_store = NULL;
GHashTable* session_store = (GHashTable*)user_data;
GHashTable* device_store = NULL;
GHashTableIter iter;
gpointer key, value;
@@ -115,37 +115,35 @@ get_sub_device_sessions(signal_int_list **sessions, const char *name,
signal_int_list_push_back(*sessions, GPOINTER_TO_INT(key));
}
return SG_SUCCESS;
}
#ifdef HAVE_LIBSIGNAL_LT_2_3_2
int
store_session(const signal_protocol_address *address, uint8_t *record,
size_t record_len, void *user_data)
store_session(const signal_protocol_address* address, uint8_t* record,
size_t record_len, void* user_data)
#else
int
store_session(const signal_protocol_address *address,
uint8_t *record, size_t record_len,
uint8_t *user_record, size_t user_record_len,
void *user_data)
store_session(const signal_protocol_address* address,
uint8_t* record, size_t record_len,
uint8_t* user_record, size_t user_record_len,
void* user_data)
#endif
{
GHashTable *session_store = (GHashTable *)user_data;
GHashTable *device_store = NULL;
GHashTable* session_store = (GHashTable*)user_data;
GHashTable* device_store = NULL;
device_store = g_hash_table_lookup(session_store, (void *)address->name);
device_store = g_hash_table_lookup(session_store, (void*)address->name);
if (!device_store) {
device_store = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)signal_buffer_free);
g_hash_table_insert(session_store, strdup(address->name), device_store);
}
signal_buffer *buffer = signal_buffer_create(record, record_len);
signal_buffer* buffer = signal_buffer_create(record, record_len);
g_hash_table_insert(device_store, GINT_TO_POINTER(address->device_id), buffer);
char *record_b64 = g_base64_encode(record, record_len);
char *device_id = g_strdup_printf("%d", address->device_id);
char* record_b64 = g_base64_encode(record, record_len);
char* device_id = g_strdup_printf("%d", address->device_id);
g_key_file_set_string(omemo_sessions_keyfile(), address->name, device_id, record_b64);
free(device_id);
g_free(record_b64);
@@ -156,10 +154,10 @@ store_session(const signal_protocol_address *address,
}
int
contains_session(const signal_protocol_address *address, void *user_data)
contains_session(const signal_protocol_address* address, void* user_data)
{
GHashTable *session_store = (GHashTable *)user_data;
GHashTable *device_store = NULL;
GHashTable* session_store = (GHashTable*)user_data;
GHashTable* device_store = NULL;
device_store = g_hash_table_lookup(session_store, address->name);
if (!device_store) {
@@ -174,10 +172,10 @@ contains_session(const signal_protocol_address *address, void *user_data)
}
int
delete_session(const signal_protocol_address *address, void *user_data)
delete_session(const signal_protocol_address* address, void* user_data)
{
GHashTable *session_store = (GHashTable *)user_data;
GHashTable *device_store = NULL;
GHashTable* session_store = (GHashTable*)user_data;
GHashTable* device_store = NULL;
device_store = g_hash_table_lookup(session_store, address->name);
if (!device_store) {
@@ -186,7 +184,7 @@ delete_session(const signal_protocol_address *address, void *user_data)
g_hash_table_remove(device_store, GINT_TO_POINTER(address->device_id));
char *device_id_str = g_strdup_printf("%d", address->device_id);
char* device_id_str = g_strdup_printf("%d", address->device_id);
g_key_file_remove_key(omemo_sessions_keyfile(), address->name, device_id_str, NULL);
g_free(device_id_str);
omemo_sessions_keyfile_save();
@@ -195,10 +193,10 @@ delete_session(const signal_protocol_address *address, void *user_data)
}
int
delete_all_sessions(const char *name, size_t name_len, void *user_data)
delete_all_sessions(const char* name, size_t name_len, void* user_data)
{
GHashTable *session_store = (GHashTable *)user_data;
GHashTable *device_store = NULL;
GHashTable* session_store = (GHashTable*)user_data;
GHashTable* device_store = NULL;
device_store = g_hash_table_lookup(session_store, name);
if (!device_store) {
@@ -211,10 +209,10 @@ delete_all_sessions(const char *name, size_t name_len, void *user_data)
}
int
load_pre_key(signal_buffer **record, uint32_t pre_key_id, void *user_data)
load_pre_key(signal_buffer** record, uint32_t pre_key_id, void* user_data)
{
signal_buffer *original;
GHashTable *pre_key_store = (GHashTable *)user_data;
signal_buffer* original;
GHashTable* pre_key_store = (GHashTable*)user_data;
original = g_hash_table_lookup(pre_key_store, GINT_TO_POINTER(pre_key_id));
if (original == NULL) {
@@ -226,17 +224,17 @@ load_pre_key(signal_buffer **record, uint32_t pre_key_id, void *user_data)
}
int
store_pre_key(uint32_t pre_key_id, uint8_t *record, size_t record_len,
void *user_data)
store_pre_key(uint32_t pre_key_id, uint8_t* record, size_t record_len,
void* user_data)
{
GHashTable *pre_key_store = (GHashTable *)user_data;
GHashTable* pre_key_store = (GHashTable*)user_data;
signal_buffer *buffer = signal_buffer_create(record, record_len);
signal_buffer* buffer = signal_buffer_create(record, record_len);
g_hash_table_insert(pre_key_store, GINT_TO_POINTER(pre_key_id), buffer);
/* Long term storage */
char *pre_key_id_str = g_strdup_printf("%d", pre_key_id);
char *record_b64 = g_base64_encode(record, record_len);
char* pre_key_id_str = g_strdup_printf("%d", pre_key_id);
char* record_b64 = g_base64_encode(record, record_len);
g_key_file_set_string(omemo_identity_keyfile(), OMEMO_STORE_GROUP_PREKEYS, pre_key_id_str, record_b64);
g_free(pre_key_id_str);
g_free(record_b64);
@@ -247,22 +245,22 @@ store_pre_key(uint32_t pre_key_id, uint8_t *record, size_t record_len,
}
int
contains_pre_key(uint32_t pre_key_id, void *user_data)
contains_pre_key(uint32_t pre_key_id, void* user_data)
{
GHashTable *pre_key_store = (GHashTable *)user_data;
GHashTable* pre_key_store = (GHashTable*)user_data;
return g_hash_table_lookup(pre_key_store, GINT_TO_POINTER(pre_key_id)) != NULL;
}
int
remove_pre_key(uint32_t pre_key_id, void *user_data)
remove_pre_key(uint32_t pre_key_id, void* user_data)
{
GHashTable *pre_key_store = (GHashTable *)user_data;
GHashTable* pre_key_store = (GHashTable*)user_data;
int ret = g_hash_table_remove(pre_key_store, GINT_TO_POINTER(pre_key_id));
/* Long term storage */
char *pre_key_id_str = g_strdup_printf("%d", pre_key_id);
char* pre_key_id_str = g_strdup_printf("%d", pre_key_id);
g_key_file_remove_key(omemo_identity_keyfile(), OMEMO_STORE_GROUP_PREKEYS, pre_key_id_str, NULL);
g_free(pre_key_id_str);
@@ -276,11 +274,11 @@ remove_pre_key(uint32_t pre_key_id, void *user_data)
}
int
load_signed_pre_key(signal_buffer **record, uint32_t signed_pre_key_id,
void *user_data)
load_signed_pre_key(signal_buffer** record, uint32_t signed_pre_key_id,
void* user_data)
{
signal_buffer *original;
GHashTable *signed_pre_key_store = (GHashTable *)user_data;
signal_buffer* original;
GHashTable* signed_pre_key_store = (GHashTable*)user_data;
original = g_hash_table_lookup(signed_pre_key_store, GINT_TO_POINTER(signed_pre_key_id));
if (!original) {
@@ -292,17 +290,17 @@ load_signed_pre_key(signal_buffer **record, uint32_t signed_pre_key_id,
}
int
store_signed_pre_key(uint32_t signed_pre_key_id, uint8_t *record,
size_t record_len, void *user_data)
store_signed_pre_key(uint32_t signed_pre_key_id, uint8_t* record,
size_t record_len, void* user_data)
{
GHashTable *signed_pre_key_store = (GHashTable *)user_data;
GHashTable* signed_pre_key_store = (GHashTable*)user_data;
signal_buffer *buffer = signal_buffer_create(record, record_len);
signal_buffer* buffer = signal_buffer_create(record, record_len);
g_hash_table_insert(signed_pre_key_store, GINT_TO_POINTER(signed_pre_key_id), buffer);
/* Long term storage */
char *signed_pre_key_id_str = g_strdup_printf("%d", signed_pre_key_id);
char *record_b64 = g_base64_encode(record, record_len);
char* signed_pre_key_id_str = g_strdup_printf("%d", signed_pre_key_id);
char* record_b64 = g_base64_encode(record, record_len);
g_key_file_set_string(omemo_identity_keyfile(), OMEMO_STORE_GROUP_SIGNED_PREKEYS, signed_pre_key_id_str, record_b64);
g_free(signed_pre_key_id_str);
g_free(record_b64);
@@ -313,22 +311,22 @@ store_signed_pre_key(uint32_t signed_pre_key_id, uint8_t *record,
}
int
contains_signed_pre_key(uint32_t signed_pre_key_id, void *user_data)
contains_signed_pre_key(uint32_t signed_pre_key_id, void* user_data)
{
GHashTable *signed_pre_key_store = (GHashTable *)user_data;
GHashTable* signed_pre_key_store = (GHashTable*)user_data;
return g_hash_table_lookup(signed_pre_key_store, GINT_TO_POINTER(signed_pre_key_id)) != NULL;
}
int
remove_signed_pre_key(uint32_t signed_pre_key_id, void *user_data)
remove_signed_pre_key(uint32_t signed_pre_key_id, void* user_data)
{
GHashTable *signed_pre_key_store = (GHashTable *)user_data;
GHashTable* signed_pre_key_store = (GHashTable*)user_data;
int ret = g_hash_table_remove(signed_pre_key_store, GINT_TO_POINTER(signed_pre_key_id));
/* Long term storage */
char *signed_pre_key_id_str = g_strdup_printf("%d", signed_pre_key_id);
char* signed_pre_key_id_str = g_strdup_printf("%d", signed_pre_key_id);
g_key_file_remove_key(omemo_identity_keyfile(), OMEMO_STORE_GROUP_PREKEYS, signed_pre_key_id_str, NULL);
g_free(signed_pre_key_id_str);
@@ -338,10 +336,10 @@ remove_signed_pre_key(uint32_t signed_pre_key_id, void *user_data)
}
int
get_identity_key_pair(signal_buffer **public_data, signal_buffer **private_data,
void *user_data)
get_identity_key_pair(signal_buffer** public_data, signal_buffer** private_data,
void* user_data)
{
identity_key_store_t *identity_key_store = (identity_key_store_t *)user_data;
identity_key_store_t* identity_key_store = (identity_key_store_t*)user_data;
*public_data = signal_buffer_copy(identity_key_store->public);
*private_data = signal_buffer_copy(identity_key_store->private);
@@ -350,9 +348,9 @@ get_identity_key_pair(signal_buffer **public_data, signal_buffer **private_data,
}
int
get_local_registration_id(void *user_data, uint32_t *registration_id)
get_local_registration_id(void* user_data, uint32_t* registration_id)
{
identity_key_store_t *identity_key_store = (identity_key_store_t *)user_data;
identity_key_store_t* identity_key_store = (identity_key_store_t*)user_data;
*registration_id = identity_key_store->registration_id;
@@ -360,10 +358,10 @@ get_local_registration_id(void *user_data, uint32_t *registration_id)
}
int
save_identity(const signal_protocol_address *address, uint8_t *key_data,
size_t key_len, void *user_data)
save_identity(const signal_protocol_address* address, uint8_t* key_data,
size_t key_len, void* user_data)
{
identity_key_store_t *identity_key_store = (identity_key_store_t *)user_data;
identity_key_store_t* identity_key_store = (identity_key_store_t*)user_data;
if (identity_key_store->recv) {
/* Do not trust identity automatically */
@@ -377,9 +375,9 @@ save_identity(const signal_protocol_address *address, uint8_t *key_data,
}
}
signal_buffer *buffer = signal_buffer_create(key_data, key_len);
signal_buffer* buffer = signal_buffer_create(key_data, key_len);
GHashTable *trusted = g_hash_table_lookup(identity_key_store->trusted, address->name);
GHashTable* trusted = g_hash_table_lookup(identity_key_store->trusted, address->name);
if (!trusted) {
trusted = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)signal_buffer_free);
g_hash_table_insert(identity_key_store->trusted, strdup(address->name), trusted);
@@ -387,8 +385,8 @@ save_identity(const signal_protocol_address *address, uint8_t *key_data,
g_hash_table_insert(trusted, GINT_TO_POINTER(address->device_id), buffer);
/* Long term storage */
char *key_b64 = g_base64_encode(key_data, key_len);
char *device_id = g_strdup_printf("%d", address->device_id);
char* key_b64 = g_base64_encode(key_data, key_len);
char* device_id = g_strdup_printf("%d", address->device_id);
g_key_file_set_string(omemo_trust_keyfile(), address->name, device_id, key_b64);
g_free(device_id);
g_free(key_b64);
@@ -399,13 +397,13 @@ save_identity(const signal_protocol_address *address, uint8_t *key_data,
}
int
is_trusted_identity(const signal_protocol_address *address, uint8_t *key_data,
size_t key_len, void *user_data)
is_trusted_identity(const signal_protocol_address* address, uint8_t* key_data,
size_t key_len, void* user_data)
{
int ret;
identity_key_store_t *identity_key_store = (identity_key_store_t *)user_data;
identity_key_store_t* identity_key_store = (identity_key_store_t*)user_data;
GHashTable *trusted = g_hash_table_lookup(identity_key_store->trusted, address->name);
GHashTable* trusted = g_hash_table_lookup(identity_key_store->trusted, address->name);
if (!trusted) {
if (identity_key_store->recv) {
return 1;
@@ -414,14 +412,13 @@ is_trusted_identity(const signal_protocol_address *address, uint8_t *key_data,
}
}
signal_buffer *buffer = signal_buffer_create(key_data, key_len);
signal_buffer *original = g_hash_table_lookup(trusted, GINT_TO_POINTER(address->device_id));
signal_buffer* buffer = signal_buffer_create(key_data, key_len);
signal_buffer* original = g_hash_table_lookup(trusted, GINT_TO_POINTER(address->device_id));
ret = original != NULL && signal_buffer_compare(buffer, original) == 0;
signal_buffer_free(buffer);
if (identity_key_store->recv) {
return 1;
} else {
@@ -430,23 +427,23 @@ is_trusted_identity(const signal_protocol_address *address, uint8_t *key_data,
}
int
store_sender_key(const signal_protocol_sender_key_name *sender_key_name,
uint8_t *record, size_t record_len, uint8_t *user_record,
size_t user_record_len, void *user_data)
store_sender_key(const signal_protocol_sender_key_name* sender_key_name,
uint8_t* record, size_t record_len, uint8_t* user_record,
size_t user_record_len, void* user_data)
{
return SG_SUCCESS;
}
int
load_sender_key(signal_buffer **record, signal_buffer **user_record,
const signal_protocol_sender_key_name *sender_key_name,
void *user_data)
load_sender_key(signal_buffer** record, signal_buffer** user_record,
const signal_protocol_sender_key_name* sender_key_name,
void* user_data)
{
return SG_SUCCESS;
}
static void
_g_hash_table_free(GHashTable *hash_table)
_g_hash_table_free(GHashTable* hash_table)
{
g_hash_table_remove_all(hash_table);
g_hash_table_unref(hash_table);

View File

@@ -36,26 +36,27 @@
#include "config.h"
#define OMEMO_STORE_GROUP_IDENTITY "identity"
#define OMEMO_STORE_GROUP_PREKEYS "prekeys"
#define OMEMO_STORE_GROUP_SIGNED_PREKEYS "signed_prekeys"
#define OMEMO_STORE_KEY_DEVICE_ID "device_id"
#define OMEMO_STORE_KEY_REGISTRATION_ID "registration_id"
#define OMEMO_STORE_KEY_IDENTITY_KEY_PUBLIC "identity_key_public"
#define OMEMO_STORE_GROUP_IDENTITY "identity"
#define OMEMO_STORE_GROUP_PREKEYS "prekeys"
#define OMEMO_STORE_GROUP_SIGNED_PREKEYS "signed_prekeys"
#define OMEMO_STORE_KEY_DEVICE_ID "device_id"
#define OMEMO_STORE_KEY_REGISTRATION_ID "registration_id"
#define OMEMO_STORE_KEY_IDENTITY_KEY_PUBLIC "identity_key_public"
#define OMEMO_STORE_KEY_IDENTITY_KEY_PRIVATE "identity_key_private"
typedef struct {
signal_buffer *public;
signal_buffer *private;
uint32_t registration_id;
GHashTable *trusted;
bool recv;
typedef struct
{
signal_buffer* public;
signal_buffer* private;
uint32_t registration_id;
GHashTable* trusted;
bool recv;
} identity_key_store_t;
GHashTable * session_store_new(void);
GHashTable * pre_key_store_new(void);
GHashTable * signed_pre_key_store_new(void);
void identity_key_store_new(identity_key_store_t *identity_key_store);
GHashTable* session_store_new(void);
GHashTable* pre_key_store_new(void);
GHashTable* signed_pre_key_store_new(void);
void identity_key_store_new(identity_key_store_t* identity_key_store);
/**
* Returns a copy of the serialized session record corresponding to the
@@ -68,9 +69,9 @@ void identity_key_store_new(identity_key_store_t *identity_key_store);
* @return 1 if the session was loaded, 0 if the session was not found, negative on failure
*/
#ifdef HAVE_LIBSIGNAL_LT_2_3_2
int load_session(signal_buffer **record, const signal_protocol_address *address, void *user_data);
int load_session(signal_buffer** record, const signal_protocol_address* address, void* user_data);
#else
int load_session(signal_buffer **record, signal_buffer **user_record, const signal_protocol_address *address, void *user_data);
int load_session(signal_buffer** record, signal_buffer** user_record, const signal_protocol_address* address, void* user_data);
#endif
/**
@@ -81,7 +82,7 @@ int load_session(signal_buffer **record, signal_buffer **user_record, const sign
* @param name_len the length of the name
* @return size of the sessions array, or negative on failure
*/
int get_sub_device_sessions(signal_int_list **sessions, const char *name, size_t name_len, void *user_data);
int get_sub_device_sessions(signal_int_list** sessions, const char* name, size_t name_len, void* user_data);
/**
* Commit to storage the session record for a given
@@ -94,9 +95,9 @@ int get_sub_device_sessions(signal_int_list **sessions, const char *name, size_t
* @return 0 on success, negative on failure
*/
#ifdef HAVE_LIBSIGNAL_LT_2_3_2
int store_session(const signal_protocol_address *address, uint8_t *record, size_t record_len, void *user_data);
int store_session(const signal_protocol_address* address, uint8_t* record, size_t record_len, void* user_data);
#else
int store_session(const signal_protocol_address *address, uint8_t *record, size_t record_len, uint8_t *user_record, size_t user_record_len, void *user_data);
int store_session(const signal_protocol_address* address, uint8_t* record, size_t record_len, uint8_t* user_record, size_t user_record_len, void* user_data);
#endif
/**
@@ -106,7 +107,7 @@ int store_session(const signal_protocol_address *address, uint8_t *record, size_
* @param address the address of the remote client
* @return 1 if a session record exists, 0 otherwise.
*/
int contains_session(const signal_protocol_address *address, void *user_data);
int contains_session(const signal_protocol_address* address, void* user_data);
/**
* Remove a session record for a recipient ID + device ID tuple.
@@ -114,7 +115,7 @@ int contains_session(const signal_protocol_address *address, void *user_data);
* @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
*/
int delete_session(const signal_protocol_address *address, void *user_data);
int delete_session(const signal_protocol_address* address, void* user_data);
/**
* Remove the session records corresponding to all devices of a recipient ID.
@@ -123,7 +124,7 @@ int delete_session(const signal_protocol_address *address, void *user_data);
* @param name_len the length of the name
* @return the number of deleted sessions on success, negative on failure
*/
int delete_all_sessions(const char *name, size_t name_len, void *user_data);
int delete_all_sessions(const char* name, size_t name_len, void* user_data);
/**
* Load a local serialized PreKey record.
@@ -135,7 +136,7 @@ int delete_all_sessions(const char *name, size_t name_len, void *user_data);
* @retval SG_SUCCESS if the key was found
* @retval SG_ERR_INVALID_KEY_ID if the key could not be found
*/
int load_pre_key(signal_buffer **record, uint32_t pre_key_id, void *user_data);
int load_pre_key(signal_buffer** record, uint32_t pre_key_id, void* user_data);
/**
* Store a local serialized PreKey record.
@@ -145,7 +146,7 @@ int load_pre_key(signal_buffer **record, uint32_t pre_key_id, void *user_data);
* @param record_len length of the serialized record
* @return 0 on success, negative on failure
*/
int store_pre_key(uint32_t pre_key_id, uint8_t *record, size_t record_len, void *user_data);
int store_pre_key(uint32_t pre_key_id, uint8_t* record, size_t record_len, void* user_data);
/**
* Determine whether there is a committed PreKey record matching the
@@ -154,7 +155,7 @@ int store_pre_key(uint32_t pre_key_id, uint8_t *record, size_t record_len, void
* @param pre_key_id A PreKey record ID.
* @return 1 if the store has a record for the PreKey ID, 0 otherwise
*/
int contains_pre_key(uint32_t pre_key_id, void *user_data);
int contains_pre_key(uint32_t pre_key_id, void* user_data);
/**
* Delete a PreKey record from local storage.
@@ -162,7 +163,7 @@ int contains_pre_key(uint32_t pre_key_id, void *user_data);
* @param pre_key_id The ID of the PreKey record to remove.
* @return 0 on success, negative on failure
*/
int remove_pre_key(uint32_t pre_key_id, void *user_data);
int remove_pre_key(uint32_t pre_key_id, void* user_data);
/**
* Load a local serialized signed PreKey record.
@@ -174,7 +175,7 @@ int remove_pre_key(uint32_t pre_key_id, void *user_data);
* @retval SG_SUCCESS if the key was found
* @retval SG_ERR_INVALID_KEY_ID if the key could not be found
*/
int load_signed_pre_key(signal_buffer **record, uint32_t signed_pre_key_id, void *user_data);
int load_signed_pre_key(signal_buffer** record, uint32_t signed_pre_key_id, void* user_data);
/**
* Store a local serialized signed PreKey record.
@@ -184,7 +185,7 @@ int load_signed_pre_key(signal_buffer **record, uint32_t signed_pre_key_id, void
* @param record_len length of the serialized record
* @return 0 on success, negative on failure
*/
int store_signed_pre_key(uint32_t signed_pre_key_id, uint8_t *record, size_t record_len, void *user_data);
int store_signed_pre_key(uint32_t signed_pre_key_id, uint8_t* record, size_t record_len, void* user_data);
/**
* Determine whether there is a committed signed PreKey record matching
@@ -193,7 +194,7 @@ int store_signed_pre_key(uint32_t signed_pre_key_id, uint8_t *record, size_t rec
* @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
*/
int contains_signed_pre_key(uint32_t signed_pre_key_id, void *user_data);
int contains_signed_pre_key(uint32_t signed_pre_key_id, void* user_data);
/**
* Delete a SignedPreKeyRecord from local storage.
@@ -201,7 +202,7 @@ int contains_signed_pre_key(uint32_t signed_pre_key_id, void *user_data);
* @param signed_pre_key_id The ID of the signed PreKey record to remove.
* @return 0 on success, negative on failure
*/
int remove_signed_pre_key(uint32_t signed_pre_key_id, void *user_data);
int remove_signed_pre_key(uint32_t signed_pre_key_id, void* user_data);
/**
* Get the local client's identity key pair.
@@ -214,7 +215,7 @@ int remove_signed_pre_key(uint32_t signed_pre_key_id, void *user_data);
* The Signal Protocol library is responsible for freeing this buffer.
* @return 0 on success, negative on failure
*/
int get_identity_key_pair(signal_buffer **public_data, signal_buffer **private_data, void *user_data);
int get_identity_key_pair(signal_buffer** public_data, signal_buffer** private_data, void* user_data);
/**
* Return the local client's registration ID.
@@ -226,7 +227,7 @@ int get_identity_key_pair(signal_buffer **public_data, signal_buffer **private_d
* registration ID, if it was successfully retrieved.
* @return 0 on success, negative on failure
*/
int get_local_registration_id(void *user_data, uint32_t *registration_id);
int get_local_registration_id(void* user_data, uint32_t* registration_id);
/**
* Save a remote client's identity key
@@ -241,7 +242,7 @@ int get_local_registration_id(void *user_data, uint32_t *registration_id);
* @param key_len Length of the remote client's identity key
* @return 0 on success, negative on failure
*/
int save_identity(const signal_protocol_address *address, uint8_t *key_data, size_t key_len, void *user_data);
int save_identity(const signal_protocol_address* address, uint8_t* key_data, size_t key_len, void* user_data);
/**
* Verify a remote client's identity key.
@@ -259,7 +260,7 @@ int save_identity(const signal_protocol_address *address, uint8_t *key_data, siz
* @param key_len Length of the identity key to verify
* @return 1 if trusted, 0 if untrusted, negative on failure
*/
int is_trusted_identity(const signal_protocol_address *address, uint8_t *key_data, size_t key_len, void *user_data);
int is_trusted_identity(const signal_protocol_address* address, uint8_t* key_data, size_t key_len, void* user_data);
/**
* Store a serialized sender key record for a given
@@ -270,7 +271,7 @@ int is_trusted_identity(const signal_protocol_address *address, uint8_t *key_dat
* @param record_len length of the serialized record
* @return 0 on success, negative on failure
*/
int store_sender_key(const signal_protocol_sender_key_name *sender_key_name, uint8_t *record, size_t record_len, uint8_t *user_record, size_t user_record_len, void *user_data);
int store_sender_key(const signal_protocol_sender_key_name* sender_key_name, uint8_t* record, size_t record_len, uint8_t* user_record, size_t user_record_len, void* user_data);
/**
* Returns a copy of the sender key record corresponding to the
@@ -282,4 +283,4 @@ int store_sender_key(const signal_protocol_sender_key_name *sender_key_name, uin
* @param sender_key_name the (groupId + senderId + deviceId) tuple
* @return 1 if the record was loaded, 0 if the record was not found, negative on failure
*/
int load_sender_key(signal_buffer **record, signal_buffer **user_record, const signal_protocol_sender_key_name *sender_key_name, void *user_data);
int load_sender_key(signal_buffer** record, signal_buffer** user_record, const signal_protocol_sender_key_name* sender_key_name, void* user_data);