aboutsummaryrefslogtreecommitdiff
path: root/plugins/signal-protocol
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/signal-protocol')
-rw-r--r--plugins/signal-protocol/src/context.vala2
-rw-r--r--plugins/signal-protocol/src/signal_helper.c6
-rw-r--r--plugins/signal-protocol/src/signal_helper.h1
-rw-r--r--plugins/signal-protocol/vapi/signal-protocol-native.vapi4
4 files changed, 8 insertions, 5 deletions
diff --git a/plugins/signal-protocol/src/context.vala b/plugins/signal-protocol/src/context.vala
index c36bf010..87b51756 100644
--- a/plugins/signal-protocol/src/context.vala
+++ b/plugins/signal-protocol/src/context.vala
@@ -30,7 +30,7 @@ public class Context {
}
public void randomize(uint8[] data) throws Error {
- throw_by_code(Signal.native_random(native_context, data));
+ throw_by_code(Signal.native_random(data));
}
public SignedPreKeyRecord generate_signed_pre_key(IdentityKeyPair identity_key_pair, int32 id, uint64 timestamp = 0) throws Error {
diff --git a/plugins/signal-protocol/src/signal_helper.c b/plugins/signal-protocol/src/signal_helper.c
index 3630d6d6..9f313475 100644
--- a/plugins/signal-protocol/src/signal_helper.c
+++ b/plugins/signal-protocol/src/signal_helper.c
@@ -1,5 +1,4 @@
#include <signal_helper.h>
-#include <signal_protocol_internal.h>
#include <gcrypt.h>
@@ -78,7 +77,10 @@ session_signed_pre_key* session_signed_pre_key_new(uint32_t id, uint64_t timesta
return res;
}
-
+int signal_vala_randomize(uint8_t *data, size_t len) {
+ gcry_randomize(data, len, GCRY_STRONG_RANDOM);
+ return SG_SUCCESS;
+}
int signal_vala_random_generator(uint8_t *data, size_t len, void *user_data) {
gcry_randomize(data, len, GCRY_STRONG_RANDOM);
diff --git a/plugins/signal-protocol/src/signal_helper.h b/plugins/signal-protocol/src/signal_helper.h
index 819b399b..2c2c983f 100644
--- a/plugins/signal-protocol/src/signal_helper.h
+++ b/plugins/signal-protocol/src/signal_helper.h
@@ -20,6 +20,7 @@ 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);
int signal_vala_hmac_sha256_update(void *hmac_context, const uint8_t *data, size_t data_len, void *user_data);
diff --git a/plugins/signal-protocol/vapi/signal-protocol-native.vapi b/plugins/signal-protocol/vapi/signal-protocol-native.vapi
index 9161a3ed..72ba1710 100644
--- a/plugins/signal-protocol/vapi/signal-protocol-native.vapi
+++ b/plugins/signal-protocol/vapi/signal-protocol-native.vapi
@@ -269,6 +269,6 @@ namespace Signal {
[CCode (cname = "setup_signal_vala_crypto_provider", cheader_filename = "signal_helper.h")]
public static void setup_crypto_provider(NativeContext context);
- [CCode (cname = "signal_crypto_random", cheader_filename = "signal_protocol_internal.h")]
- public static int native_random(NativeContext context, uint8[] data);
+ [CCode (cname = "signal_vala_randomize", cheader_filename = "signal_helper.h")]
+ public static int native_random(uint8[] data);
}