Skip to content

dh: run the current Wycheproof X25519 and X448 vectors - #705

Merged
cjpatton merged 1 commit into
cloudflare:mainfrom
KurathSec:wycheproof-xdh
Nov 16, 2026
Merged

cjpatton merged 1 commit into
cloudflare:mainfrom
KurathSec:wycheproof-xdh

Conversation

@KurathSec

@KurathSec KurathSec commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

dh/x25519 runs an 87-case subset of Wycheproof v0.4.12, and dh/x448 runs no Wycheproof vectors. This adds the current files from C2SP/wycheproof testvectors_v1 at 3fa63dd (x25519_test.json, 518 cases, and x448_test.json, 510 cases), gzipped under each package's testdata/, and a TestWycheproofV1 in both packages. The existing X25519 test stays as it is: the current file was regenerated with different keys, so it does not contain the old cases.

The check is the one the existing X25519 test uses: the shared secret must match, and Shared must return true unless the case is acceptable. The 12 invalid X448 cases have 57-byte public keys, which a Key cannot hold, so they count as rejected by the type.

All cases pass on main, also under GOOS=js GOARCH=wasm and with -tags purego. golangci-lint (v2.12.2) and the shadow check are clean.


Devin Review

Adds testvectors_v1/x25519_test.json and x448_test.json at 3fa63dd.
Copilot AI lite review requested due to automatic review settings September 23, 2026 13:39

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved review comments remain.

Review effort: Lite
Findings: None

What changed in this PR

Adds current C2SP Wycheproof v1 coverage for X25519 and X448 key agreement.

Changes:

  • Adds tests for 518 X25519 and 510 X448 vectors.
  • Adds compressed vector fixtures.
  • Handles malformed X448 keys as rejected cases.
File Description
dh/​x448/​key_test.go Adds Wycheproof v1 coverage for X448.
dh/​x25519/​key_test.go Adds Wycheproof v1 coverage for X25519.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@cjpatton
cjpatton merged commit 31be93d into cloudflare:main Nov 16, 2026
1 check passed
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.

3 participants