hashlib.algorithms_available doesn't account for backends loaded dynamically at runtime
未關閉
還沒有人認領這個 Issue。
stdlib
topic-SSL
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
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 1b6acaad9a18b2498386c60f24351ab749061e3a backported, 3.9.12
- Operating system and architecture: Gentoo Linux amd64
- OpenSSL version: 3.0.3
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 hashlib.algorithms_available 和 hashlib.new 進入點開始,並重現執行階段載入 OpenSSL 的 legacy provider 後的行為。追蹤可用雜湊集合的填入方式,然後驗證新載入的後端所公開的雜湊會出現在 algorithms_available 中,同時 hashlib.new 仍能正常運作。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- cryptography
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100