aboutsummaryrefslogtreecommitdiff
path: root/plugins/signal-protocol/src
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2020-01-09 13:39:36 +0100
committerMarvin W <git@larma.de>2020-01-09 13:39:36 +0100
commitb2af8c51124819d7c5d0bd348c52a0b15f54d582 (patch)
treee0e762d61dbd980bc9322b43d76461038671944a /plugins/signal-protocol/src
parent3650288a111625a24515e511fa7f1feff697b726 (diff)
downloaddino-b2af8c51124819d7c5d0bd348c52a0b15f54d582.tar.gz
dino-b2af8c51124819d7c5d0bd348c52a0b15f54d582.zip
Fix various typing issues in signal bindings
Diffstat (limited to 'plugins/signal-protocol/src')
-rw-r--r--plugins/signal-protocol/src/context.vala6
-rw-r--r--plugins/signal-protocol/src/signal_helper.c23
-rw-r--r--plugins/signal-protocol/src/signal_helper.h7
3 files changed, 11 insertions, 25 deletions
diff --git a/plugins/signal-protocol/src/context.vala b/plugins/signal-protocol/src/context.vala
index 87b51756..40a07b0f 100644
--- a/plugins/signal-protocol/src/context.vala
+++ b/plugins/signal-protocol/src/context.vala
@@ -14,7 +14,7 @@ public class Context {
ctx.mutex.unlock();
}
- static void stderr_log(LogLevel level, string message, void* user_data) {
+ static void stderr_log(LogLevel level, string message, size_t len, void* user_data) {
printerr(@"$level: $message\n");
}
@@ -44,7 +44,9 @@ public class Context {
Gee.Set<PreKeyRecord> res = new Gee.HashSet<PreKeyRecord>();
for(uint i = start; i < start+count; i++) {
ECKeyPair pair = generate_key_pair();
- res.add(new PreKeyRecord(i, pair));
+ PreKeyRecord record;
+ throw_by_code(PreKeyRecord.create(out record, i, pair));
+ res.add(record);
}
return res;
}
diff --git a/plugins/signal-protocol/src/signal_helper.c b/plugins/signal-protocol/src/signal_helper.c
index 2d765420..41b11fd7 100644
--- a/plugins/signal-protocol/src/signal_helper.c
+++ b/plugins/signal-protocol/src/signal_helper.c
@@ -2,13 +2,13 @@
#include <gcrypt.h>
-signal_type_base* signal_type_ref_vapi(signal_type_base* instance) {
+signal_type_base* signal_type_ref_vapi(void* instance) {
g_return_val_if_fail(instance != NULL, NULL);
signal_type_ref(instance);
return instance;
}
-signal_type_base* signal_type_unref_vapi(signal_type_base* instance) {
+signal_type_base* signal_type_unref_vapi(void* instance) {
g_return_val_if_fail(instance != NULL, NULL);
signal_type_unref(instance);
return NULL;
@@ -17,7 +17,7 @@ signal_type_base* signal_type_unref_vapi(signal_type_base* instance) {
signal_protocol_address* signal_protocol_address_new(const gchar* name, int32_t device_id) {
g_return_val_if_fail(name != NULL, NULL);
signal_protocol_address* address = malloc(sizeof(signal_protocol_address));
- address->device_id = NULL;
+ address->device_id = -1;
address->name = NULL;
signal_protocol_address_set_name(address, name);
signal_protocol_address_set_device_id(address, device_id);
@@ -55,7 +55,7 @@ gchar* signal_protocol_address_get_name(signal_protocol_address* self) {
}
int32_t signal_protocol_address_get_device_id(signal_protocol_address* self) {
- g_return_val_if_fail(self != NULL, NULL);
+ g_return_val_if_fail(self != NULL, -1);
return self->device_id;
}
@@ -64,19 +64,6 @@ void signal_protocol_address_set_device_id(signal_protocol_address* self, int32_
self->device_id = device_id;
}
-
-session_pre_key* session_pre_key_new(uint32_t pre_key_id, ec_key_pair* pair, int* err) {
- session_pre_key* res;
- *err = session_pre_key_create(&res, pre_key_id, pair);
- return res;
-}
-
-session_signed_pre_key* session_signed_pre_key_new(uint32_t id, uint64_t timestamp, ec_key_pair* pair, uint8_t* key, int key_len, int* err) {
- session_signed_pre_key* res;
- *err = session_signed_pre_key_create(&res, id, timestamp, pair, key, key_len);
- return res;
-}
-
int signal_vala_randomize(uint8_t *data, size_t len) {
gcry_randomize(data, len, GCRY_STRONG_RANDOM);
return SG_SUCCESS;
@@ -107,7 +94,7 @@ int signal_vala_hmac_sha256_init(void **hmac_context, const uint8_t *key, size_t
}
int signal_vala_hmac_sha256_update(void *hmac_context, const uint8_t *data, size_t data_len, void *user_data) {
- gcry_mac_hd_t* *ctx = hmac_context;
+ gcry_mac_hd_t* ctx = hmac_context;
if (gcry_mac_write(*ctx, data, data_len)) return SG_ERR_UNKNOWN;
diff --git a/plugins/signal-protocol/src/signal_helper.h b/plugins/signal-protocol/src/signal_helper.h
index 2c2c983f..949a3c7b 100644
--- a/plugins/signal-protocol/src/signal_helper.h
+++ b/plugins/signal-protocol/src/signal_helper.h
@@ -7,8 +7,8 @@
#define SG_CIPHER_AES_GCM_NOPADDING 1000
-signal_type_base* signal_type_ref_vapi(signal_type_base* what);
-signal_type_base* signal_type_unref_vapi(signal_type_base* what);
+signal_type_base* signal_type_ref_vapi(void* what);
+signal_type_base* signal_type_unref_vapi(void* what);
signal_protocol_address* signal_protocol_address_new(const gchar* name, int32_t device_id);
void signal_protocol_address_free(signal_protocol_address* ptr);
@@ -17,9 +17,6 @@ gchar* signal_protocol_address_get_name(signal_protocol_address* self);
void signal_protocol_address_set_device_id(signal_protocol_address* self, int32_t device_id);
int32_t signal_protocol_address_get_device_id(signal_protocol_address* self);
-session_pre_key* session_pre_key_new(uint32_t pre_key_id, ec_key_pair* pair, int* err);
-session_signed_pre_key* session_signed_pre_key_new(uint32_t id, uint64_t timestamp, ec_key_pair* pair, uint8_t* key, int key_len, int* err);
-
int signal_vala_randomize(uint8_t *data, size_t len);
int signal_vala_random_generator(uint8_t *data, size_t len, void *user_data);
int signal_vala_hmac_sha256_init(void **hmac_context, const uint8_t *key, size_t key_len, void *user_data);