FFSend: 64 bit sequence numbers

This commit is contained in:
M66B 2022-07-31 22:23:38 +02:00
parent 4a0b3bfd72
commit a43e424f7a
1 changed files with 3 additions and 2 deletions

View File

@ -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