Do not use signal_protocol_internal.h

This commit is contained in:
Marvin W 2019-02-12 15:27:58 -06:00
parent 864196d2ac
commit 4a8d628924
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
4 changed files with 8 additions and 5 deletions

View file

@ -30,7 +30,7 @@ public class Context {
} }
public void randomize(uint8[] data) throws Error { 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 { public SignedPreKeyRecord generate_signed_pre_key(IdentityKeyPair identity_key_pair, int32 id, uint64 timestamp = 0) throws Error {

View file

@ -1,5 +1,4 @@
#include <signal_helper.h> #include <signal_helper.h>
#include <signal_protocol_internal.h>
#include <gcrypt.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; 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) { int signal_vala_random_generator(uint8_t *data, size_t len, void *user_data) {
gcry_randomize(data, len, GCRY_STRONG_RANDOM); gcry_randomize(data, len, GCRY_STRONG_RANDOM);

View file

@ -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_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); 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_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_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); int signal_vala_hmac_sha256_update(void *hmac_context, const uint8_t *data, size_t data_len, void *user_data);

View file

@ -269,6 +269,6 @@ namespace Signal {
[CCode (cname = "setup_signal_vala_crypto_provider", cheader_filename = "signal_helper.h")] [CCode (cname = "setup_signal_vala_crypto_provider", cheader_filename = "signal_helper.h")]
public static void setup_crypto_provider(NativeContext context); public static void setup_crypto_provider(NativeContext context);
[CCode (cname = "signal_crypto_random", cheader_filename = "signal_protocol_internal.h")] [CCode (cname = "signal_vala_randomize", cheader_filename = "signal_helper.h")]
public static int native_random(NativeContext context, uint8[] data); public static int native_random(uint8[] data);
} }