Skip to content

x25519: Ensure serialized privkeys are clamped - #402

Merged
tarcieri merged 3 commits into
RustCrypto:masterfrom
rozbb:x25519-clamp-on-ser
Oct 25, 2026
Merged

tarcieri merged 3 commits into
RustCrypto:masterfrom
rozbb:x25519-clamp-on-ser

Conversation

@rozbb

@rozbb rozbb commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Currently, X25519 private keys are not serialized in clamped form. This is a violation of the HPKE spec. More details in #401.

This PR resolves #401 and adds a regression test. Technically, HPKE also requires that privkeys be clamped on DEserialization. But we don't actually have to do this. Scalars are always clamped in the x25519(scalar, point) DH function.

This is a breaking API change.

@tarcieri tarcieri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security audit failure is unrelated

@tarcieri
tarcieri merged commit 6f3808c into RustCrypto:master Oct 25, 2026
56 checks passed
@tarcieri tarcieri mentioned this pull request Oct 26, 2026
tarcieri added a commit that referenced this pull request Oct 27, 2026
## Changed
- Bump `ctutils` to v0.4.5; MSRV 1.87 (#405)

## Fixed
- Ensure serialized X25519 private keys are clamped (#402)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dhkem: Serialized X25519 privkeys are not clamped

2 participants