In PyCrypto 2.6 Crypto.SelfTest.Util.test_number.MiscTests.test_negative_number_roundtrip_mpzToLongObj_longObjToMPZ() fails with disabled support for GMP and MPIR. This test was absent in PyCrypto 2.5.
$ ./configure --without-gmp --without-mpir
...
$ python2.7 setup.py build
...
$ python2.7 setup.py test
running test
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................SelfTest: You can ignore the RandomPool_DeprecationWarning that follows.
........E...................
======================================================================
ERROR: test_negative_number_roundtrip_mpzToLongObj_longObjToMPZ (Crypto.SelfTest.Util.test_number.MiscTests)
Test that mpzToLongObj and longObjToMPZ (internal functions) roundtrip negative numbers correctly.
----------------------------------------------------------------------
Traceback (most recent call last):
File "build/lib.linux-x86_64-2.7/Crypto/SelfTest/Util/test_number.py", line 283, in test_negative_number_roundtrip_mpzToLongObj_longObjToMPZ
k = number._fastmath.rsa_construct(n, e)
AttributeError: 'NoneType' object has no attribute 'rsa_construct'
----------------------------------------------------------------------
Ran 1031 tests in 208.341s
FAILED (errors=1)
Traceback (most recent call last):
File "setup.py", line 456, in <module>
core.setup(**kw)
File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 336, in run
SelfTest.run(module=moduleObj, verbosity=self.verbose, stream=sys.stdout, config=self.config)
File "build/lib.linux-x86_64-2.7/Crypto/SelfTest/__init__.py", line 74, in run
raise SelfTestError("Self-test failed", result)
Crypto.SelfTest.SelfTestError: ('Self-test failed', <unittest.runner.TextTestResult run=1031 errors=1 failures=0>)
Thanks for the bug report.
Sebastian Ramacher fixed this bug in the following pull request:
https:/ /github. com/dlitz/ pycrypto/ pull/22 /github. com/sebastinas/ pycrypto/ commit/ d31f7df39a6d3db 73a16909de4669d 337b69c40c
https:/
It's now been merged into the pycrypto master branch.