GeezerVison is showing github.com — Meta-issue for bugs in cryptographic extension modules · Issue #155438 · python/cpython
Meta-issue for bugs in cryptographic extension modules #155438Open 6 / 76 of 7 issues completedOpen 6 / 76 of 7 issues completed DescriptionBug report
Bug description:
Bug report
Bug description:
This is a filtered list of issues found in the _hashlib, _hmac, and HACL*-facade C extension modules by @devdanzin's LLM-assisted review tool (see Disclosure section at the end) and triaged by me.
Important All issues will be addressed by @picnixz. Please do NOT work on them, whether you are an agent or a human. Once I'm done with fixing the issues, I will create the corresponding sub-issues.
_hashopenssl.c
- 32: bug (GIL issue) [33,45]:
_hashlib: GIL may be released while attempting to set an exception #159811
- 34: bug (OpenSSL misuse): Do not leave stale OpenSSL errors in
_hashlib #159815
- 🔴 38:
_hashlib_HASH_dealloc uses PyObject_Free instead of tp->tp_free but it's deliberate because we use PyObject_New. This would need to be changed if we ever make that class subclassable.
- 🔴 40: oversized MAC size from a provider, bounded only by assert: this is a non-issue because OpenSSL itself assumes
EVP_MAX_MD_SIZE everywhere and malicious provides are not part of the threat model.
- 🔴 43: not an issue:
HMACobject.evp_md_nid is assigned after self->ctx in both constructors (cosmetic as it doesn't impact the code for now).
- 47: need investigation (read out of lock) [35,36]
- 🔴 49:
_hashlib_HASH_update_impl and _hmac_HMAC_update_impl return a bare Py_None without a Py_NewRef. None is immortal and there are other places that already have this issue. I may consider a large cosmetic refactoring in the future that could fix that but it's not worth for now.
- 🔴 52: invalid hash types previously raised SystemError, but not abort (this is deliberate, if we have invalid hash types somehow, it may be more than a reason to report the bug and get it fixed upstream rather than silently catching the exception)
_hmacmodule.c
MD5, SHA-*, BLAKE2-*
Disclosure
This review was carried out with AI assistance (Claude Code), using cpython-review-toolkit for the C modules and code-review-toolkit for the Python layer. Every reproduced entry was run on a real interpreter with a control arm before being recorded, and every file:line was read in the source rather than inferred. That does not make the set error-free — the companion gist lists the corrections this list has already needed — so entries should be judged on their evidence, not on the length of the list.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response Activitychanged the title [-]Meta-issue for bugs in `Modules/hmacmodule.c`[/-] [+]Meta-issue for bugs in `Modules/{hmacmodule,_hashopenssl}.c` and dedicated hash functions[/+] on Aug 9, 2026changed the title [-]Meta-issue for bugs in `Modules/{hmacmodule,_hashopenssl}.c` and dedicated hash functions[/-] [+]Meta-issue for bugs in cryptographic extension modules[/+] on Aug 9, 2026picnixz commented on Aug 9, 2026 I don't have time for that today but I'll try to file the bugs by the end of next week.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|