Skip to content

Add caller-supplied policy authorization for firmware upgrade#560

Draft
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:firmware_upgrade_policy_auth
Draft

Add caller-supplied policy authorization for firmware upgrade#560
dgarske wants to merge 1 commit into
wolfSSL:masterfrom
dgarske:firmware_upgrade_policy_auth

Conversation

@dgarske

@dgarske dgarske commented Jul 24, 2026

Copy link
Copy Markdown
Member

No description provided.

@dgarske dgarske self-assigned this Jul 24, 2026
Copilot AI review requested due to automatic review settings July 24, 2026 22:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 via TPM2_PolicyOR.
  • Added wolfTPM2_FirmwareUpgradeHash_ex(..., startSession) and routed the legacy wolfTPM2_FirmwareUpgradeHash() through it (preserving existing behavior when startSession == 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 thread src/tpm2_wrap.c
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));
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.

2 participants