diff options
Diffstat (limited to 'plugins/signal-protocol/src')
-rw-r--r-- | plugins/signal-protocol/src/context.vala | 2 | ||||
-rw-r--r-- | plugins/signal-protocol/src/signal_helper.c | 6 | ||||
-rw-r--r-- | plugins/signal-protocol/src/signal_helper.h | 1 |
3 files changed, 6 insertions, 3 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); |