Skip to content

Commit

Permalink
Apply minimal padding.
Browse files Browse the repository at this point in the history
SSL 3.0 requires minimal padding. (TLS doesn't require it but accepts it, so
apply uniformly to both.)

From Chromium.
  • Loading branch information
davidben committed Mar 24, 2015
1 parent fa8db51 commit daf2e15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tlslite/tlsrecordlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,9 @@ def _sendMsg(self, msg, randomizeFirstBlock = True):
b = self.fixedIVBlock + b

#Add padding: b = b+ (macBytes + paddingBytes)
currentLength = len(b) + len(macBytes) + 1
currentLength = len(b) + len(macBytes)
blockLength = self._writeState.encContext.block_size
paddingLength = blockLength-(currentLength % blockLength)
paddingLength = blockLength - 1 - (currentLength % blockLength)

paddingBytes = bytearray([paddingLength] * (paddingLength+1))
if self.fault == Fault.badPadding:
Expand Down

0 comments on commit daf2e15

Please sign in to comment.