aboutsummaryrefslogtreecommitdiff
path: root/plugins/signal-protocol/src/signal_helper.h
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-03-11 01:29:38 +0100
committerMarvin W <git@larma.de>2017-03-11 23:59:04 +0100
commitd5ea5172a754848c10d061a4a9dd777f63ba71c1 (patch)
treeaeb7694b93158e23714f481a5cdfb5c87b59b630 /plugins/signal-protocol/src/signal_helper.h
parente27d63269d0b41fa8d5b5f0f2e4a9dc7de4b9ab9 (diff)
downloaddino-d5ea5172a754848c10d061a4a9dd777f63ba71c1.tar.gz
dino-d5ea5172a754848c10d061a4a9dd777f63ba71c1.zip
Add OMEMO via Plugin
Diffstat (limited to 'plugins/signal-protocol/src/signal_helper.h')
-rw-r--r--plugins/signal-protocol/src/signal_helper.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/signal-protocol/src/signal_helper.h b/plugins/signal-protocol/src/signal_helper.h
new file mode 100644
index 00000000..b4b05582
--- /dev/null
+++ b/plugins/signal-protocol/src/signal_helper.h
@@ -0,0 +1,43 @@
+#ifndef SIGNAL_PROTOCOL_VALA_HELPER
+#define SIGNAL_PROTOCOL_VALA_HELPER 1
+
+#include <signal_protocol.h>
+#include <string.h>
+#include <glib.h>
+
+#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_protocol_address* signal_protocol_address_new();
+void signal_protocol_address_free(signal_protocol_address* ptr);
+void signal_protocol_address_set_name(signal_protocol_address* self, const gchar* name);
+gchar* signal_protocol_address_get_name(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_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);
+int signal_vala_hmac_sha256_final(void *hmac_context, signal_buffer **output, void *user_data);
+void signal_vala_hmac_sha256_cleanup(void *hmac_context, void *user_data);
+int signal_vala_sha512_digest_init(void **digest_context, void *user_data);
+int signal_vala_sha512_digest_update(void *digest_context, const uint8_t *data, size_t data_len, void *user_data);
+int signal_vala_sha512_digest_final(void *digest_context, signal_buffer **output, void *user_data);
+void signal_vala_sha512_digest_cleanup(void *digest_context, void *user_data);
+
+int signal_vala_encrypt(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 signal_vala_decrypt(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);
+void setup_signal_vala_crypto_provider(signal_context *context);
+
+#endif \ No newline at end of file