Re: [gentoo-portage-dev] [PATCH 1/2] checksum: Fix overriding fallbacks on broken pycrypto
W dniu 28.02.2017, wto o godzinie 23∶57 -0800, użytkownik Zac Medico napisał: > On 02/28/2017 11:34 PM, Michał Górny wrote: > > 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 > > > > > > Looks good. Thanks. Merged both patches. -- Best regards, Michał Górny signature.asc Description: This is a digitally signed message part
Re: [gentoo-portage-dev] [PATCH 1/2] checksum: Fix overriding fallbacks on broken pycrypto
On 02/28/2017 11:34 PM, Michał Górny wrote: > 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 > > Looks good. -- Thanks, Zac
[gentoo-portage-dev] [PATCH 1/2] 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 -- 2.12.0