From a1f1dfb3ae995ecbe483881504cc2a730c134763 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Fri, 30 Jan 2015 00:41:06 -0500 Subject: [PATCH] Apply minimal padding. SSL 3.0 requires minimal padding. (TLS doesn't require it but accepts it, so apply uniformly to both.) From Chromium. --- tlslite/tlsrecordlayer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tlslite/tlsrecordlayer.py b/tlslite/tlsrecordlayer.py index 5fe74102..97533c95 100644 --- a/tlslite/tlsrecordlayer.py +++ b/tlslite/tlsrecordlayer.py @@ -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: