mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
Code layout.
This commit is contained in:
@@ -120,8 +120,9 @@ class IncomingEncryptionLayer implements FrameReader {
|
|||||||
if(payloadLength > plaintextLength - HEADER_LENGTH)
|
if(payloadLength > plaintextLength - HEADER_LENGTH)
|
||||||
throw new FormatException();
|
throw new FormatException();
|
||||||
// If there's any padding it must be all zeroes
|
// If there's any padding it must be all zeroes
|
||||||
for(int i = HEADER_LENGTH + payloadLength; i < plaintextLength; i++)
|
for(int i = HEADER_LENGTH + payloadLength; i < plaintextLength; i++) {
|
||||||
if(frame[i] != 0) throw new FormatException();
|
if(frame[i] != 0) throw new FormatException();
|
||||||
|
}
|
||||||
frameNumber++;
|
frameNumber++;
|
||||||
return payloadLength;
|
return payloadLength;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,8 +97,9 @@ class OutgoingEncryptionLayer implements FrameWriter {
|
|||||||
ciphertextLength = frameLength;
|
ciphertextLength = frameLength;
|
||||||
}
|
}
|
||||||
// If there's any padding it must all be zeroes
|
// If there's any padding it must all be zeroes
|
||||||
for(int i = HEADER_LENGTH + payloadLength; i < plaintextLength; i++)
|
for(int i = HEADER_LENGTH + payloadLength; i < plaintextLength; i++) {
|
||||||
frame[i] = 0;
|
frame[i] = 0;
|
||||||
|
}
|
||||||
// Encrypt and authenticate the frame
|
// Encrypt and authenticate the frame
|
||||||
FrameEncoder.encodeIv(iv, frameNumber);
|
FrameEncoder.encodeIv(iv, frameNumber);
|
||||||
FrameEncoder.encodeAad(aad, frameNumber, plaintextLength);
|
FrameEncoder.encodeAad(aad, frameNumber, plaintextLength);
|
||||||
|
|||||||
Reference in New Issue
Block a user