`generichash_blake2b_final()` aborts for a directly constructed state with digest size 65
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.2k
- Forks
- 267
- Avg merge
- 42m
- Merged PRs (30d)
- 2
Description
Summary
nacl.bindings.crypto_generichash.generichash_blake2b_final() aborts the Python process when its Blake2State has a digest size of 65.
This requires constructing the state wrapper directly instead of using generichash_blake2b_init(), which validates the digest size.
I found this while fuzzing Python C extension modules.
This looks like a bug, but please let me know if handling directly constructed states is outside the intended behavior.
Versions
PyNaCl 1.6.2, CPython 3.12.3, Ubuntu 24.04.4 x86_64, glibc 2.39.
Reproducer
from nacl.bindings.crypto_generichash import Blake2State, generichash_blake2b_final
generichash_blake2b_final(Blake2State(65))
This process exited with SIGABRT.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided Python reproducer for Blake2State(65), then inspect nacl.bindings.crypto_generichash.generichash_blake2b_final() and the Blake2State wrapper. Done means a directly constructed state with digest size 65 no longer aborts the Python process, with regression coverage for that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- cryptography, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100