From a43e424f7ae94eabe171d0a92d9751869d527589 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 31 Jul 2022 22:23:38 +0200 Subject: [PATCH] FFSend: 64 bit sequence numbers --- app/src/extra/java/eu/faircode/email/Send.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/extra/java/eu/faircode/email/Send.java b/app/src/extra/java/eu/faircode/email/Send.java index 8f6fa9bafe..009dbaad00 100644 --- a/app/src/extra/java/eu/faircode/email/Send.java +++ b/app/src/extra/java/eu/faircode/email/Send.java @@ -107,7 +107,8 @@ public class Send { // network byte order = transmitting the most significant byte first // Java = big endian = network byte order // sizeof(int) = 4 bytes - int seq = 0; + // sizeof(long) = 8 bytes + long seq = 0; byte[] buffer = new byte[65536]; byte[] salt = new byte[16]; @@ -168,7 +169,7 @@ public class Send { byte[] nonce = Arrays.copyOf(nonce_base, nonce_base.length); ByteBuffer xor = ByteBuffer.wrap(nonce); - xor.putInt(nonce.length - 4, xor.getInt(nonce.length - 4) ^ seq); + xor.putLong(nonce.length - 8, xor.getLong(nonce.length - 8) ^ seq); Log.i("Send seq=" + seq + " nonce=" + Helper.hex(nonce)); // encrypt with AEAD_AES_128_GCM; final size is rs; the last record can be smaller