Skip to content

Optimize cert chain parsing - #48

Open
timweri wants to merge 5 commits into
mainfrom
add-hw-tests
Open

timweri wants to merge 5 commits into
mainfrom
add-hw-tests

Conversation

@timweri

@timweri timweri commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator
  • Parse attestation root chains only once. For each leaf attestation, we only verify 1 signature to make sure the leaf attestation chains up to the already verified chains.
  • Add attestations from an actual Yubikey on 5.8.0 to tests.

@timweri timweri changed the title Add real 5.8.0 attestations for tests Optimize cert chain parsing Sep 24, 2026
@timweri
timweri requested a balanced review from Copilot September 24, 2026 16:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

The cached signer lookup preserves verification behavior and the new B2 chains are covered by representative tests.

Review effort: Balanced
Findings: None

What changed in this PR

Optimizes Yubico attestation verification by caching trusted signer certificates and selecting them by issuer.

Changes:

  • Cache parsed PIV and FIDO signers with OnceLock.
  • Verify intermediates directly against matched signers.
  • Add YubiKey 5.8.0 B2-chain coverage.
File Description
src/​yubikey/​verification.rs Optimizes PIV chain verification.
src/​fido/​verification.rs Optimizes FIDO chain verification.
tests/​yubikey-lite.rs Adds PIV 5.8.0 coverage.
tests/​fido-lite.rs Adds FIDO 5.8.0 coverage.

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

@timweri
timweri marked this pull request as ready for review September 24, 2026 16:31
@timweri
timweri requested a review from obelisk September 24, 2026 16:32
@timweri

timweri commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

@obelisk The verify functions don't work in the const block.

error[E0015]: cannot call non-const function `verify_certificate_chain` in constants

We can put the validation in build.rs. But I think OnceLock is good enough for now.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants