]> git.pld-linux.org Git - packages/python-Crypto.git/blob - pycrypto-fix-pubkey-size-divisions.patch
- added Fedora patches (including CVE-2013-7459,CVE-2018-6594 fixes; excluding python...
[packages/python-Crypto.git] / pycrypto-fix-pubkey-size-divisions.patch
1 setup.py for Python 3 doesn't invoke 2to3 on pct-speedtest.py, which runs
2 into problems:
3
4 Traceback (most recent call last):
5   File "pct-speedtest.py", line 218, in <module>
6     Benchmark().run()
7   File "pct-speedtest.py", line 200, in run
8     self.test_pubkey_setup(pubkey_name, module, key_bytes)
9   File "pct-speedtest.py", line 85, in test_pubkey_setup
10     keys = self.random_keys(key_bytes)[:5]
11   File "pct-speedtest.py", line 49, in random_keys
12     return self.random_blocks(bytes, 10**5)     # 100k
13   File "pct-speedtest.py", line 53, in random_blocks
14     data = self.random_data(bytes)
15   File "pct-speedtest.py", line 62, in random_data
16     self.__random_data = self._random_bytes(bytes)
17   File "pct-speedtest.py", line 73, in _random_bytes
18     return os.urandom(b)
19   File "/usr/lib64/python3.2/os.py", line 777, in urandom
20     bs += read(_urandomfd, n - len(bs))
21 TypeError: integer argument expected, got float
22
23 This is due to the divisions in the pubkey_specs table, which in Python 3 is
24 true division, returning a float.
25
26 As it happens, 2to3 can't convert these divisions, see:
27 http://bugs.python.org/issue12831
28
29 Change them to explicitly be floor divisions (supported in Python 2.2
30 onwards; see PEP 0238)
31
32 --- pycrypto/pct-speedtest.py
33 +++ pycrypto/pct-speedtest.py
34 @@ -165,9 +165,9 @@
35  
36      def run(self):
37          pubkey_specs = [
38 -            ("RSA(1024)", RSA, 1024/8),
39 -            ("RSA(2048)", RSA, 2048/8),
40 -            ("RSA(4096)", RSA, 4096/8),
41 +            ("RSA(1024)", RSA, 1024//8),
42 +            ("RSA(2048)", RSA, 2048//8),
43 +            ("RSA(4096)", RSA, 4096//8),
44              ]
45          block_specs = [
46              ("DES", DES, 8),
This page took 0.030652 seconds and 3 git commands to generate.