Code layout.

This commit is contained in:
akwizgran
2012-08-29 18:54:44 +01:00
parent c8038a5865
commit 5b4f566822
2 changed files with 4 additions and 2 deletions

View File

@@ -120,8 +120,9 @@ class IncomingEncryptionLayer implements FrameReader {
if(payloadLength > plaintextLength - HEADER_LENGTH)
throw new FormatException();
// 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();
}
frameNumber++;
return payloadLength;
}

View File

@@ -97,8 +97,9 @@ class OutgoingEncryptionLayer implements FrameWriter {
ciphertextLength = frameLength;
}
// 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;
}
// Encrypt and authenticate the frame
FrameEncoder.encodeIv(iv, frameNumber);
FrameEncoder.encodeAad(aad, frameNumber, plaintextLength);