fix(verify): TPM qualifying_data check uses implemented key thumbprint#360
Merged
Conversation
…print The TPM verifier checked qualifying_data == SHA-256(pubkey || session_id), the old nonce formula, while the TPM provider commits the §3.3 nonce's first 32 bytes (the RFC 7638 JWK thumbprint of the key). It was also passed cnf.jwk.x (base64url) into bytes.fromhex(), so the check always errored. Now the dispatcher re-derives the thumbprint from cnf.jwk.x and the verifier compares it (constant-time) to the quote's qualifying_data, matching the generic CRYPTO-001 key binding and the SEV-SNP/TDX paths. - verify_tpm_measurement: replace tee_public_key_hex/session_id with expected_qualifying_data: bytes - verify.py dispatcher computes expected_qd via _jwk_thumbprint_sha256(cnf.jwk.x) - claim-hw-attestation experiment updated to the new signature - tests: rewrite qualifying_data unit tests + add end-to-end verify_trace_claim tests for match and key-substitution rejection - spec: TPM quote commits nonce[:32] (the thumbprint) Verified: ruff + mypy clean, 756 unit tests pass (3 skipped).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #359.
Problem
The TPM verifier checked
qualifying_data == SHA-256(pubkey || session_id)— the old nonce formula — while the TPM provider commits the §3.3 nonce's first 32 bytes (JWK_thumbprint(tee_public_key)). The dispatcher also passedcnf.jwk.x(base64url) into a param fed tobytes.fromhex(), so the check always raised andqualifying_datawas never actually verified.Fix
verify_tpm_measurement: replacetee_public_key_hex/session_idwithexpected_qualifying_data: bytes.verify.pydispatcher re-derives the thumbprint via_jwk_thumbprint_sha256(cnf.jwk.x)and passes it in; comparison is constant-time (hmac.compare_digest).claim-hw-attestationexperiment updated to the new signature.nonce[:32](the thumbprint).Tests
qualifying_dataunit tests to the new signature.verify_trace_claimtests: a quote committing the key's real thumbprint verifies; a quote bound to a different key is rejected.Verified locally: ruff + mypy clean, 756 unit tests pass (3 skipped).
Still needs real TPM hardware
EK cert-chain validation to the manufacturer CA remains stubbed (
unverified_fields), unchanged here.🤖 Generated with Claude Code