All PKEY methods implementing signing or secure hashing should fail if the value for siglen is too small
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 30.8k
- Forks
- 11.5k
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
The documentation for EVP_DigestSignFinal() mentions the following precondition:
If sig is not NULL then before the call the siglen parameter should contain the length of the sig buffer.
This implies that the siglen parameter actually has some significance and is being checked to be sufficiently large by the function(s) that fill(s) the sig buffer. The expectation is that the function fails if that check fails. Indeed, this mechanism can be observed here:
However, most PKEY sign(-like) methods do not seem to include such a check. For example see
Contributor guide
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 comparing the size handling in crypto/ec/ec_pmeth.c with the signing path in crypto/hmac/hm_pmeth.c. Trace the other PKEY sign-like methods and identify where siglen is accepted without validating the output buffer size. Done means every signing or secure-hashing PKEY method fails when siglen is too small; add or update relevant tests if the existing test locations are found during the review.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- cryptography
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100