summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-02-28 23:15:20 +0100
committerMichał Górny <mgorny@gentoo.org>2017-03-01 16:42:24 +0100
commit1c7b39c6cb89da22038291ae69528ac5486fd10c (patch)
tree8d052954c437cf7a2412b8fa97ced25d18d77367
parentrepoman: Warn about stale CVS keywords in ebuild header bug 610954 (diff)
downloadportage-1c7b39c6cb89da22038291ae69528ac5486fd10c.tar.gz
portage-1c7b39c6cb89da22038291ae69528ac5486fd10c.tar.bz2
portage-1c7b39c6cb89da22038291ae69528ac5486fd10c.zip
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.
-rw-r--r--pym/portage/checksum.py12
1 files 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