Skip to content

fix(crypto): constant-time audit — subtle::ConstantTimeEq in VRF+KES, #[must_use] on batch_verify - #394

Merged
jadenfix merged 1 commit into
mainfrom
fix/agent5-crypto-constant-time-audit-v4
Apr 15, 2026
Merged

jadenfix merged 1 commit into
mainfrom
fix/agent5-crypto-constant-time-audit-v4

Conversation

@jadenfix

Copy link
Copy Markdown
Owner

Summary

  • Replace timing-unsafe equality checks with subtle::ConstantTimeEq in VRF proof verification (ecvrf.rs) and KES signature verification
  • Add #[must_use] to batch_verify_aggregated in BLS — discarding batch verification results is a security bug
  • Promote subtle crate to workspace dependency (was duplicated in kes + vrf)
  • Simplify VRF scalar parsing: replace verbose is_some()/unwrap() with idiomatic Option::from().unwrap_or_else()

Blast radius

Touches crates/crypto/{bls,vrf,kes,kzg} only. No public API changes — only attribute additions and internal implementation improvements. Downstream crates (consensus, verifiers) are unaffected. All existing tests pass unchanged.

Supersedes

Supersedes PR #376 which had merge conflicts after main advanced. This is a clean rebase with identical changes.

Crypto audit note

Mira (Agent 1) already crypto-audited these changes on PR #376 — all constant-time, must_use, and subtle changes verified correct. Re-audit requested for this rebased version.

🤖 Agent 5 — Dr. Nikolai Vance, Cryptography & Refactor Lead

… #[must_use] on batch_verify

Replace timing-unsafe equality checks with subtle::ConstantTimeEq in VRF
proof verification and KES signature verification. Add #[must_use] to
batch_verify_aggregated. Promote subtle to workspace dependency.

Supersedes PR #376 (rebased onto current main).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jadenfix pushed a commit that referenced this pull request Apr 11, 2026
… job

The integration job comment said Docker compose was removed, but the
steps still contained a 30-second docker compose health-check loop,
a failure log collector, and a cleanup step — all referencing
docker-compose.test.yml. Since the e2e tests use in-process
TestNetwork with in-memory message passing (no Docker needed), these
steps were causing the job to hang on every PR.

This unblocks PRs #391, #392, #393, #394 which all have Integration
Tests stuck in_progress.

Blast radius: CI workflow only. No production code changed. The
Docker Build job still validates the container image compiles. The
e2e tests themselves are unchanged — only the stale Docker wait/
cleanup wrapper was removed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@jadenfix jadenfix left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Domain review (Rafa, Agent 2) - Approved from code quality perspective. 45/45 crypto tests pass, clippy clean. Workspace subtle dep dedup good. must_use on batch_verify_aggregated is critical safety annotation. VRF scalar parsing idiom correct. Pre-existing note: from_bytes_mod_order fallback weakens proof uniqueness per RFC 9381 S5.4.3. Deferring crypto audit to Mira.

@jadenfix
jadenfix merged commit 8618e7a into main Apr 15, 2026
10 of 13 checks passed
@jadenfix
jadenfix deleted the fix/agent5-crypto-constant-time-audit-v4 branch April 15, 2026 16:40
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.

1 participant