Visitar URL original
hashlib.algorithms_available doesn't account for backends loaded dynamically at runtime · Issue #92874 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20220630072807/https://github.com/python/cpython/issues/92874
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hashlib.algorithms_available doesn't account for backends loaded dynamically at runtime #92874

Open
mgorny opened this issue May 17, 2022 · 0 comments
Labels
expert-SSL type-bug

Comments

@mgorny
Copy link
Contributor

@mgorny mgorny commented May 17, 2022 •

Bug report

If additional OpenSSL backends are loaded at runtime (this happens e.g. when importing PyOpenSSL), the hashlib.algorithms_available doesn't get updated for the newly available hashes.

Trivial reproducer:

>>> import ctypes, hashlib
>>> ctypes.CDLL("libssl.so").OSSL_PROVIDER_load(None, b"legacy")
-1311283920
>>> "md4" in hashlib.algorithms_available
False
>>> hashlib.new("md4")
<md4 _hashlib.HASH object @ 0x7f404308faf0>

Your environment

  • CPython versions tested on: 3.11.0b1, 3.10.4 with 1b6acaa backported, 3.9.12
  • Operating system and architecture: Gentoo Linux amd64
  • OpenSSL version: 3.0.3
@mgorny mgorny added the type-bug label May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expert-SSL type-bug
Projects
None yet
Development

No branches or pull requests

2 participants