commit:     d8f9c763a180b5b014b333791dd7235cbf923d31
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 20 03:24:39 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Mar 21 02:30:23 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d8f9c763

checksum: drop pygcrypt support

No longer in Gentoo and the codepath for this has been disabled since 2017(!)
because of https://bugs.gentoo.org/615620.

The last release on pypi is also from April 2017.

Bug: https://bugs.gentoo.org/615620
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/checksum.py | 46 ----------------------------------------------
 1 file changed, 46 deletions(-)

diff --git a/lib/portage/checksum.py b/lib/portage/checksum.py
index 307dd4429..fdb8387a7 100644
--- a/lib/portage/checksum.py
+++ b/lib/portage/checksum.py
@@ -148,52 +148,6 @@ if "SHA3_256" not in hashfunc_map or "SHA3_512" not in 
hashfunc_map:
         pass
 
 
-# Support pygcrypt as fallback using optimized routines from libgcrypt
-# (GnuPG).
-gcrypt_algos = frozenset(
-    ("RMD160", "WHIRLPOOL", "SHA3_256", "SHA3_512")
-)
-# Note: currently disabled due to resource exhaustion bugs in pygcrypt.
-# Please do not reenable until upstream has a fix.
-# https://bugs.gentoo.org/615620
-if False:
-    # if gcrypt_algos.difference(hashfunc_map):
-    try:
-        import binascii
-        import pygcrypt.hashcontext
-
-        class GCryptHashWrapper:
-            def __init__(self, algo):
-                self._obj = pygcrypt.hashcontext.HashContext(algo=algo, 
secure=False)
-
-            def update(self, data):
-                self._obj.write(data)
-
-            def hexdigest(self):
-                return binascii.b2a_hex(self._obj.read()).decode()
-
-        name_mapping = {
-            "RMD160": "ripemd160",
-            "WHIRLPOOL": "whirlpool",
-            "SHA3_256": "sha3-256",
-            "SHA3_512": "sha3-512",
-        }
-
-        for local_name, gcry_name in name_mapping.items():
-            try:
-                pygcrypt.hashcontext.HashContext(algo=gcry_name)
-            except Exception:  # yes, it throws Exception...
-                pass
-            else:
-                _generate_hash_function(
-                    local_name,
-                    functools.partial(GCryptHashWrapper, gcry_name),
-                    origin="pygcrypt",
-                )
-    except ImportError:
-        pass
-
-
 # Use pycrypto when available, prefer it over the internal fallbacks
 # Check for 'new' attributes, since they can be missing if the module
 # is broken somehow.

Reply via email to