Skip to content

Commit

Permalink
TLSv1.2 versions of OCSPUnderflow probe
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Aug 27, 2016
1 parent fb3b084 commit 4a7d7cf
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions prober.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@
OCSPOverflow12(),
OCSPOverflow12PFS(),
OCSPUnderflow(),
OCSPUnderflow12(),
OCSPUnderflow12PFS(),
DoubleExtension()
]

Expand Down
10 changes: 10 additions & 0 deletions probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,16 @@ def test(self, sock):
sock.write(self.make_ocsp_hello('\x01' + '\x00' * 6))


class OCSPUnderflow12(OCSPUnderflow, NormalHandshake12):
'''As with OCSPUnderflow but in TLSv1.2 hello'''
pass


class OCSPUnderflow12PFS(OCSPUnderflow, NormalHandshake12PFS):
'''As with OCSPUnderflow but in PFS TLSv1.2 hello'''
pass


class DoubleExtension(NormalHandshake):
'''Duplicate secure renegotiation extension'''

Expand Down
44 changes: 44 additions & 0 deletions tests/test_probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2171,6 +2171,50 @@ def test_test(self):
b'\x01\x00\x00\x00\x00\x00\x00'])


class TestOCSPUnderflow12(unittest.TestCase):
def test_test(self):
probe = OCSPUnderflow12()
sock = MockSock()

probe.test(sock)

self.maxDiff = None
self.assertEqual(sock.sent_data,
[b'\x16\x03\x01\x00^'
b'\x01\x00\x00Z'
b'\x03\x03' +
RANDOM_STR +
b'\x00'
b'\x00&' +
DEFAULT_12_CIPHERS_STR +
b'\x01\x00'
b'\x00\x0b'
b'\x00\x05\x00\x07'
b'\x01\x00\x00\x00\x00\x00\x00'])


class TestOCSPUnderflow12PFS(unittest.TestCase):
def test_test(self):
probe = OCSPUnderflow12PFS()
sock = MockSock()

probe.test(sock)

self.maxDiff = None
self.assertEqual(sock.sent_data,
[b"\x16\x03\x01\x00\x96"
b"\x01\x00\x00\x92"
b"\x03\x03" +
RANDOM_STR +
b"\x00"
b"\x00^" +
DEFAULT_PFS_CIPHERS_STR +
b"\x01\x00"
b'\x00\x0b'
b'\x00\x05\x00\x07'
b'\x01\x00\x00\x00\x00\x00\x00'])


class TestDoubleExtension(unittest.TestCase):
def test_test(self):
probe = DoubleExtension()
Expand Down

0 comments on commit 4a7d7cf

Please sign in to comment.