Add caller-supplied policy authorization for firmware upgrade#560
Draft
dgarske wants to merge 1 commit into
Draft
Add caller-supplied policy authorization for firmware upgrade#560dgarske wants to merge 1 commit into
dgarske wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends wolfTPM’s firmware-upgrade wrappers to support caller-supplied authorization sessions (e.g., policy sessions) for the vendor “firmware start” command, enabling platforms that gate upgrade behind custom platform hierarchy policies.
Changes:
- Added a
wolfTPM2_PolicyOR()wrapper to satisfy policy sessions viaTPM2_PolicyOR. - Added
wolfTPM2_FirmwareUpgradeHash_ex(..., startSession)and routed the legacywolfTPM2_FirmwareUpgradeHash()through it (preserving existing behavior whenstartSession == NULL). - Updated the ST33 firmware update example and documentation to demonstrate/describe policy-based authorization and a safe self-test flow.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| wolftpm/tpm2_wrap.h | Declares new wolfTPM2_PolicyOR wrapper and wolfTPM2_FirmwareUpgradeHash_ex API with caller-supplied session support. |
| src/tpm2_wrap.c | Implements wolfTPM2_PolicyOR and adds the _ex firmware upgrade routing + vendor start-session plumbing. |
| examples/firmware/st33_fw_update.c | Adds --policytest self-test to validate policy-session + PolicyOR behavior without performing an upgrade. |
| examples/firmware/README.md | Documents advanced policy-based firmware start authorization and the new _ex API usage. |
Comment on lines
+10659
to
+10670
| PolicyOR_In policyOR; | ||
|
|
||
| if (dev == NULL || tpmSession == NULL || pHashList == NULL) { | ||
| return BAD_FUNC_ARG; | ||
| } | ||
| if (pHashList->count == 0 || | ||
| pHashList->count > (word32)(sizeof(pHashList->digests) / | ||
| sizeof(pHashList->digests[0]))) { | ||
| return BAD_FUNC_ARG; | ||
| } | ||
|
|
||
| XMEMSET(&policyOR, 0, sizeof(policyOR)); |
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.