openssl / openssl/openssl

EVP_PKEY_decapsulate and EVP_PKEY_encapsulate docs inconsistent with extant providers

Open
#26,209 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

branch: 3.2 branch: 3.3 branch: 3.4 branch: master triaged: documentation
Dominant language
C
Stars
30.8k
Forks
11.5k
Avg merge
10m
Merged PRs (30d)
1

Description

The issue came up in the review ML-KEM refactor PR: https://github.com/openssl/openssl/pull/26054#discussion_r1890252190

It appears that the new ML-KEM provider expected that the shared secret (and output ciphertext in the case of encapsulation) length pointers are non-NULL and hold the provided buffer sizes. However, the docs seem to suggest that these length pointers are optional.
If any application actually sends NULL pointers, null-pointer-deferences will follow in at least the ec and ecx providers.

Either the docs need to be updated, or this is a broad (easily fixed) bug in the extant providers.

Cc: @mattcaswell, @levitte, @t8m

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 with the EVP_PKEY_decapsulate and EVP_PKEY_encapsulate documentation and the ec, ecx, and ML-KEM provider implementations. Compare the documented handling of the length pointers with the provider expectations and the review discussion in PR #26054. Done means the API contract and provider behavior are consistent, with tests covering the relevant NULL-pointer cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cryptography
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.