mirror of https://github.com/M66B/FairEmail.git
FFSend: 64 bit sequence numbers
This commit is contained in:
parent
4a0b3bfd72
commit
a43e424f7a
|
@ -107,7 +107,8 @@ public class Send {
|
||||||
// network byte order = transmitting the most significant byte first
|
// network byte order = transmitting the most significant byte first
|
||||||
// Java = big endian = network byte order
|
// Java = big endian = network byte order
|
||||||
// sizeof(int) = 4 bytes
|
// sizeof(int) = 4 bytes
|
||||||
int seq = 0;
|
// sizeof(long) = 8 bytes
|
||||||
|
long seq = 0;
|
||||||
byte[] buffer = new byte[65536];
|
byte[] buffer = new byte[65536];
|
||||||
|
|
||||||
byte[] salt = new byte[16];
|
byte[] salt = new byte[16];
|
||||||
|
@ -168,7 +169,7 @@ public class Send {
|
||||||
|
|
||||||
byte[] nonce = Arrays.copyOf(nonce_base, nonce_base.length);
|
byte[] nonce = Arrays.copyOf(nonce_base, nonce_base.length);
|
||||||
ByteBuffer xor = ByteBuffer.wrap(nonce);
|
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));
|
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
|
// encrypt with AEAD_AES_128_GCM; final size is rs; the last record can be smaller
|
||||||
|
|
Loading…
Reference in New Issue