aboutsummaryrefslogtreecommitdiff
path: root/plugins/omemo
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2019-03-07 20:17:56 +0100
committerMarvin W <git@larma.de>2019-03-07 20:17:56 +0100
commitcc7b0aa7bd5b6599159f654fdd8a2fd111e16a3e (patch)
treecbe96f538bdcf4eb6e4f041d326f2d094278fdbb /plugins/omemo
parent6de86c2733a26eb5034087ab25205ba1cba1e279 (diff)
downloaddino-cc7b0aa7bd5b6599159f654fdd8a2fd111e16a3e.tar.gz
dino-cc7b0aa7bd5b6599159f654fdd8a2fd111e16a3e.zip
Move GCM tag into per-device-encrypted area to be compatible with current OMEMO version, fixes #514
Diffstat (limited to 'plugins/omemo')
-rw-r--r--plugins/omemo/src/trust_manager.vala11
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/omemo/src/trust_manager.vala b/plugins/omemo/src/trust_manager.vala
index cd0971f8..4ec141f0 100644
--- a/plugins/omemo/src/trust_manager.vala
+++ b/plugins/omemo/src/trust_manager.vala
@@ -99,7 +99,12 @@ public class TrustManager {
uint8[] iv = new uint8[16];
Plugin.get_context().randomize(iv);
- uint8[] ciphertext = aes_encrypt(Cipher.AES_GCM_NOPADDING, key, iv, message.body.data);
+ uint8[] aes_encrypt_result = aes_encrypt(Cipher.AES_GCM_NOPADDING, key, iv, message.body.data);
+ uint8[] ciphertext = aes_encrypt_result[0:aes_encrypt_result.length-16];
+ uint8[] tag = aes_encrypt_result[aes_encrypt_result.length-16:aes_encrypt_result.length];
+ uint8[] keytag = new uint8[key.length + tag.length];
+ Memory.copy(keytag, key, key.length);
+ Memory.copy((uint8*)keytag + key.length, tag, tag.length);
StanzaNode header;
StanzaNode encrypted = new StanzaNode.build("encrypted", NS_URI).add_self_xmlns()
@@ -121,7 +126,7 @@ public class TrustManager {
try {
address.name = recipient.bare_jid.to_string();
address.device_id = (int) device_id;
- StanzaNode key_node = create_encrypted_key(key, address, module.store);
+ StanzaNode key_node = create_encrypted_key(keytag, address, module.store);
header.put_node(key_node);
status.other_success++;
} catch (Error e) {
@@ -139,7 +144,7 @@ public class TrustManager {
if (device_id != module.store.local_registration_id) {
address.device_id = (int) device_id;
try {
- StanzaNode key_node = create_encrypted_key(key, address, module.store);
+ StanzaNode key_node = create_encrypted_key(keytag, address, module.store);
header.put_node(key_node);
status.own_success++;
} catch (Error e) {