summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2017-02-20 05:39:47 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2017-02-20 05:44:02 +0300
commit8f7c934625129b4dde3e57163a6b1a2b01bc5963 (patch)
tree9026d734d839ae7f9279414c5bf887829a235d56 /protocols
parent87b41c81709eef515f9c6d2bf70d3f854e31fbbc (diff)
protocols:
jabber: omemo: init_device functio (skeletoon..)
Diffstat (limited to 'protocols')
-rwxr-xr-xprotocols/JabberG/src/jabber_omemo.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp
index 9af0a2bb39..6cd11cbe42 100755
--- a/protocols/JabberG/src/jabber_omemo.cpp
+++ b/protocols/JabberG/src/jabber_omemo.cpp
@@ -361,11 +361,11 @@ namespace omemo {
{
signal_mutex.unlock();
}
+ signal_context *global_context;
int init_omemo()
{
signal_mutex.unlock(); //fuck...
- signal_context *global_context;
signal_context_create(&global_context, NULL);
signal_crypto_provider provider;
provider.random_func = &random_func;
@@ -380,10 +380,35 @@ namespace omemo {
provider.encrypt_func = &encrypt_func;
provider.decrypt_func = &decrypt_func;
- signal_context_set_crypto_provider(global_context, &provider);
- signal_context_set_locking_functions(global_context, &lock, &unlock);
+ if (signal_context_set_crypto_provider(global_context, &provider))
+ {
+ //TODO: handle error
+ }
+
+ if (signal_context_set_locking_functions(global_context, &lock, &unlock))
+ {
+ //TODO: handle error
+ }
return 0;
}
+ struct omemo_device
+ {
+ int id;
+ ec_key_pair *device_key;
+ };
+
+ omemo_device* init_device()
+ {
+ omemo_device *dev = (omemo_device*)mir_alloc(sizeof(omemo_device));
+ Utils_GetRandom((void*)dev->id, 4);
+ if (curve_generate_key_pair(global_context, &(dev->device_key)))
+ {
+ //TODO: handle error
+ }
+
+ return dev;
+ }
+
};