xen/arch/x86/tpm.c: add CRB interface support + response validation fix#28
Open
accek-itl wants to merge 2 commits intoTrenchBoot:aem-staging-2026-03-13from
Open
xen/arch/x86/tpm.c: add CRB interface support + response validation fix#28accek-itl wants to merge 2 commits intoTrenchBoot:aem-staging-2026-03-13from
accek-itl wants to merge 2 commits intoTrenchBoot:aem-staging-2026-03-13from
Conversation
Assisted-by: Claude:claude-opus-4-6
Assisted-by: Claude:claude-opus-4-6
| * header (10) | parameterSize (4) | TPML_DIGEST_VALUES | authArea | ||
| * finish_r overlays: h (10) | paramSize (4) | hashCount (4) | hashes[] | ||
| */ | ||
| if ( o_size < sizeof(cmd_rsp.finish_r) + sizeof(uint32_t) ) |
Member
There was a problem hiding this comment.
Why sizeof(uint32_t)? That's first hash alg and 2 first bytes of the hash.
| uint32_t data_buf_pa = TPM_BASE + CRB_DATA_BUFFER_(loc); | ||
| unsigned expected; | ||
|
|
||
| crb_cmd_ready(loc); |
Member
There was a problem hiding this comment.
Not sure why, but coreboot's driver follows this with a wait for no error in CRB_CTRL_STS_ and then a wait for CRB_CTRL_START_ being zero.
| tpm_write32(CRB_CTRL_RSP_ADDR_(loc), data_buf_pa); | ||
| tpm_write32(CRB_CTRL_RSP_ADDR_(loc) + 4, 0); | ||
|
|
||
| memcpy(__va(data_buf_pa), buf, i_size); |
Member
There was a problem hiding this comment.
No check for i_size being too large.
| } | ||
|
|
||
| /* Read header to learn the response length. */ | ||
| memcpy(buf, __va(data_buf_pa), sizeof(struct tpm_rsp_hdr)); |
Member
There was a problem hiding this comment.
*o_size could be too small here.
| static void crb_send_cmd(unsigned loc, uint8_t *buf, unsigned i_size, | ||
| unsigned *o_size) | ||
| { | ||
| uint32_t data_buf_pa = TPM_BASE + CRB_DATA_BUFFER_(loc); |
Member
There was a problem hiding this comment.
Should make no difference but upstream will likely prefer this version:
Suggested change
| uint32_t data_buf_pa = TPM_BASE + CRB_DATA_BUFFER_(loc); | |
| paddr_t data_buf_pa = TPM_BASE + CRB_DATA_BUFFER_(loc); |
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.
No description provided.