Linux 任何遇到过的 python import paramiko 和 Crypto 错误,比如“不使用 mpz_powm_sec。”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9171983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 04:26:32  来源:igfitidea点击:

any met python import paramiko and Crypto err like "Not using mpz_powm_sec."?

pythonlinuxredhat

提问by plutoid2012

OS: redhat 5.2 i386

操作系统:红帽 5.2 i386

python: 2.7

蟒蛇:2.7

err like:

错误如:

Python 2.7.2 (default, Feb  7 2012, 11:16:30) 
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
/home/master/local/lib/python2.7/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
  _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)

it's my libgmp version:

这是我的 libgmp 版本:

 ldconfig -p |grep libgmp
        libgmpxx.so.3 (libc6, hwcap: 0x0000000004000000) => /usr/lib/sse2/libgmpxx.so.3
        libgmpxx.so.3 (libc6) => /usr/lib/libgmpxx.so.3
        libgmpxx.so (libc6) => /usr/lib/libgmpxx.so
        libgmp.so.3 (libc6, hwcap: 0x0000000004000000) => /usr/lib/sse2/libgmp.so.3
        libgmp.so.3 (libc6) => /usr/lib/libgmp.so.3
        libgmp.so (libc6) => /usr/lib/libgmp.so

all above seems like related to libgmp,that confused me.PLZ show me some suggestion,thx!

以上似乎都与libgmp有关,这让我很困惑。请给我一些建议,谢谢!

回答by Kimvais

This is normal - RHEL 5 seems to have GMP version 4.x, and therefore the Python libraries are built against that version.

这是正常的 - RHEL 5 似乎具有 GMP 版本 4.x,因此 Python 库是针对该版本构建的。

Rebuild the GMP library from official sources and rebuild your Python after that, if you really want to get rid of the warning.

如果您真的想摆脱警告,请从官方来源重建 GMP 库并在此之后重建您的 Python。

You could consider upgrading to an more modern OS - EL5 will be EOP by the end of this year. Or at least update your OS to the latest revision (5.7)

您可以考虑升级到更现代的操作系统 - EL5 将在今年年底实现 EOP。或者至少将您的操作系统更新到最新版本 (5.7)

回答by Nocturn

I had this problem too and rebuilding python (in my case 2.7) was not sufficient. I had to reinstall pycryptowith pip after compiling the newer version of gmp, in fact, I don't know if rebuilding python was necessary but I still did it following Kimvais answer.

我也有这个问题,重建 python(在我的例子中是 2.7)是不够的。编译新版本的gmp后,我不得不用pip重新安装pycrypto,事实上,我不知道是否有必要重建python,但我还是按照Kimvais的回答做了。