openssl / openssl/openssl

All PKEY methods implementing signing or secure hashing should fail if the value for siglen is too small

Open
#12,609 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triaged: bug
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:

https://github.com/openssl/openssl/blob/e2e09d9fba1187f8d6aafaa34d4172f56f1ffb72/crypto/ec/ec_pmeth.c#L118

However, most PKEY sign(-like) methods do not seem to include such a check. For example see

https://github.com/openssl/openssl/blob/894da2fb7ed5d314ee5c2fc9fd2d9b8b74111596/crypto/hmac/hm_pmeth.c#L127

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.