From 3970a30e142104ad04e7404e72121379a6776a7d Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Fri, 2 Mar 2018 10:23:30 -0800 Subject: [PATCH] Add chunk IV to chunk MAC --- src/org/thoughtcrime/securesms/backup/FullBackupExporter.java | 1 + src/org/thoughtcrime/securesms/backup/FullBackupImporter.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/org/thoughtcrime/securesms/backup/FullBackupExporter.java b/src/org/thoughtcrime/securesms/backup/FullBackupExporter.java index a5e90a1960..20f0a32e05 100644 --- a/src/org/thoughtcrime/securesms/backup/FullBackupExporter.java +++ b/src/org/thoughtcrime/securesms/backup/FullBackupExporter.java @@ -256,6 +256,7 @@ public class FullBackupExporter extends FullBackupBase { try { Conversions.intToByteArray(iv, 0, counter++); cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(cipherKey, "AES"), new IvParameterSpec(iv)); + mac.update(iv); byte[] buffer = new byte[8192]; int read; diff --git a/src/org/thoughtcrime/securesms/backup/FullBackupImporter.java b/src/org/thoughtcrime/securesms/backup/FullBackupImporter.java index d5c914e209..1620b26158 100644 --- a/src/org/thoughtcrime/securesms/backup/FullBackupImporter.java +++ b/src/org/thoughtcrime/securesms/backup/FullBackupImporter.java @@ -171,6 +171,7 @@ public class FullBackupImporter extends FullBackupBase { try { Conversions.intToByteArray(iv, 0, counter++); cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(cipherKey, "AES"), new IvParameterSpec(iv)); + mac.update(iv); byte[] buffer = new byte[8192];