Skip to content

[Quote V5 Support] Determine if relaunch is required for TD #89

Open
Sourabh-25 wants to merge 3 commits intogoogle:mainfrom
Sourabh-25:relaunch-v5
Open

[Quote V5 Support] Determine if relaunch is required for TD #89
Sourabh-25 wants to merge 3 commits intogoogle:mainfrom
Sourabh-25:relaunch-v5

Conversation

@Sourabh-25
Copy link
Collaborator

Update TCB verification to align with Intel DCAP logic for TDX Quote V5. This enables the "Relaunch Advised" check by utilizing the new teeTcbSvn2 field to determine if a guest relaunch would resolve an OutOfDate status.

Changes

  • V5 Support: Added getTeeTcbSvn to extract teeTcbSvn and teeTcbSvn2 from both V4 and V5 quote bodies.
  • Decoupled Statuses: Updated readTcbInfoTcbStatus to return both Platform TCB and TDX Module levels independently.
  • Relaunch Logic:
    • Triggers when tdxModuleTcbStatus is OutOfDate.
    • Compares teeTcbSvn2 components against the latest TCB levels.
    • Returns specific "relaunch advised" errors if the secondary SVN meets the latest requirements.
  • Helper: Added isConfigurationNeeded to consolidate complex TCB status checks.

Copy link
Collaborator

@vbalain vbalain left a comment

Choose a reason for hiding this comment

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

LGTM!

tdxModuleTcbStatus = tdxModuleFound.TcbStatus
}

if teeTcbSvn2 != nil && (tdxModuleTcbStatus == pcs.TcbComponentStatusOutOfDate || tdxModuleTcbStatus == pcs.TcbComponentStatusOutOfDateConfigurationNeeded) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: let's move it to a separate function so that it's clear tee tcb svn2 is used for relaunch check

if teeTcbSvn2 != nil && (tdxModuleTcbStatus == pcs.TcbComponentStatusOutOfDate || tdxModuleTcbStatus == pcs.TcbComponentStatusOutOfDateConfigurationNeeded) {
latestTcbLevel := tcbInfo.TcbLevels[0]

if teeTcbSvn2[1] == 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's add a comment explaining a little bit about what is being done here.

}

func readTcbInfoTcbStatus(tcbInfo pcs.TcbInfo, tdQuoteBody any, pckCertExtensions *pcs.PckExtensions) (pcs.TcbLevel, error) {
func readTcbInfoTcbStatus(tcbInfo pcs.TcbInfo, tdQuoteBody any, pckCertExtensions *pcs.PckExtensions) (pcs.TcbLevel, pcs.TcbLevel, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you explain why two pcs.TcbLevel are required in return arguments?
Also, a comment to clarify these output arguments would be nice.

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