File: test_arc2_buffer_overflow.py

package info (click to toggle)
python-crypto 2.0.1%2Bdfsg1-2.3%2Blenny0
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 744 kB
  • ctags: 935
  • sloc: ansic: 6,597; python: 3,598; makefile: 28; sh: 10
file content (17 lines) | stat: -rw-r--r-- 434 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import unittest

class BufferOverflowTest(unittest.TestCase):
    # Test a buffer overflow found in older versions of PyCrypto

    def setUp(self):
        global ARC2
        from Crypto.Cipher import ARC2

    def runTest(self):
        """ARC2 with keylength > 128"""
        key = "x" * 16384
        mode = ARC2.MODE_ECB
        self.assertRaises(ValueError, ARC2.new, key, mode)

if __name__ == '__main__':
    unittest.main()