Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH 1/2] checksum: Fix overriding fallbacks on broken pycrypto
Date: Wed, 01 Mar 2017 07:35:25
Message-Id: 20170301073459.4130-1-mgorny@gentoo.org
1 The pycrypto override used the same variables as actual hash functions
2 before determining whether its functions are useful. As a result, if
3 pycrypto had a broken module and no hash function was generated,
4 the possible previous implementation was replaced by None.
5 ---
6 pym/portage/checksum.py | 12 ++++++------
7 1 file changed, 6 insertions(+), 6 deletions(-)
8
9 diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py
10 index a46b820af..fc38417a7 100644
11 --- a/pym/portage/checksum.py
12 +++ b/pym/portage/checksum.py
13 @@ -105,14 +105,14 @@ except ImportError:
14 # is broken somehow.
15 try:
16 from Crypto.Hash import SHA256, RIPEMD
17 - sha256hash = getattr(SHA256, 'new', None)
18 - if sha256hash is not None:
19 + sha256hash_ = getattr(SHA256, 'new', None)
20 + if sha256hash_ is not None:
21 sha256hash = _generate_hash_function("SHA256",
22 - sha256hash, origin="pycrypto")
23 - rmd160hash = getattr(RIPEMD, 'new', None)
24 - if rmd160hash is not None:
25 + sha256hash_, origin="pycrypto")
26 + rmd160hash_ = getattr(RIPEMD, 'new', None)
27 + if rmd160hash_ is not None:
28 rmd160hash = _generate_hash_function("RMD160",
29 - rmd160hash, origin="pycrypto")
30 + rmd160hash_, origin="pycrypto")
31 except ImportError:
32 pass
33
34 --
35 2.12.0

Replies