aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-03-20 03:37:26 +0000
committerSam James <sam@gentoo.org>2023-03-21 02:30:24 +0000
commitb0e43d6bc73cb63642404e661b073d6183fb9aa8 (patch)
tree735f0f64f0ad7b5efdf91286892bcbb4975daf19
parentchecksum: drop pycrypto/pycryptodome fallback for BLAKE2/SHA3 (diff)
downloadportage-b0e43d6bc73cb63642404e661b073d6183fb9aa8.tar.gz
portage-b0e43d6bc73cb63642404e661b073d6183fb9aa8.tar.bz2
portage-b0e43d6bc73cb63642404e661b073d6183fb9aa8.zip
checksum: add further comments on existing fallback logic for RIPEMD/WHIRLPOOL
Bug: https://github.com/python/cpython/issues/91257 Bug: https://github.com/python/cpython/issues/92876 Bug: https://bugs.gentoo.org/846389 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--lib/portage/checksum.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/portage/checksum.py b/lib/portage/checksum.py
index 96f3939c9..3b9796b32 100644
--- a/lib/portage/checksum.py
+++ b/lib/portage/checksum.py
@@ -99,10 +99,15 @@ class _generate_hash_function:
# Define hash functions, try to use the best module available. Preferred
# modules should go first, latter ones should check if the hashes aren't
# already defined.
-
-
# Use hashlib if available and prefer it over pycrypto and internal fallbacks.
+#
# Need special handling for RMD160/WHIRLPOOL as they may not always be provided by hashlib.
+# We keep fallbacks for RMD160/WHIRLPOOL for now as newer OpenSSLs don't expose them
+# by default.
+# See also
+# - https://github.com/python/cpython/issues/91257
+# - https://github.com/python/cpython/issues/92876
+# - https://bugs.gentoo.org/846389
_generate_hash_function("MD5", hashlib.md5, origin="hashlib")
_generate_hash_function("SHA1", hashlib.sha1, origin="hashlib")
_generate_hash_function("SHA256", hashlib.sha256, origin="hashlib")