commit:     1c7b39c6cb89da22038291ae69528ac5486fd10c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 28 22:15:20 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Mar  1 15:42:24 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1c7b39c6

checksum: Fix overriding fallbacks on broken pycrypto

The pycrypto override used the same variables as actual hash functions
before determining whether its functions are useful. As a result, if
pycrypto had a broken module and no hash function was generated,
the possible previous implementation was replaced by None.

 pym/portage/checksum.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py
index a46b820af..fc38417a7 100644
--- a/pym/portage/checksum.py
+++ b/pym/portage/checksum.py
@@ -105,14 +105,14 @@ except ImportError:
 # is broken somehow.
 try:
        from Crypto.Hash import SHA256, RIPEMD
-       sha256hash = getattr(SHA256, 'new', None)
-       if sha256hash is not None:
+       sha256hash_ = getattr(SHA256, 'new', None)
+       if sha256hash_ is not None:
                sha256hash = _generate_hash_function("SHA256",
-                       sha256hash, origin="pycrypto")
-       rmd160hash = getattr(RIPEMD, 'new', None)
-       if rmd160hash is not None:
+                       sha256hash_, origin="pycrypto")
+       rmd160hash_ = getattr(RIPEMD, 'new', None)
+       if rmd160hash_ is not None:
                rmd160hash = _generate_hash_function("RMD160",
-                       rmd160hash, origin="pycrypto")
+                       rmd160hash_, origin="pycrypto")
 except ImportError:
        pass
 

Reply via email to