Gentoo Archives: gentoo-portage-dev

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

Replies