Skip to content

feat(platform): Add 4 new platform claims for draft-ffm-rats-cca-token-03#47

Open
hqrui wants to merge 51 commits into
mainfrom
platform-claims-2.0.0
Open

feat(platform): Add 4 new platform claims for draft-ffm-rats-cca-token-03#47
hqrui wants to merge 51 commits into
mainfrom
platform-claims-2.0.0

Conversation

@hqrui

@hqrui hqrui commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Issue: #46

This PR adds 4 new platform claims for draft-ffm-rats-cca-token-03 support:

  • Client ID (mandatory, always 1)
  • TBB RoTPK (optional, array of hashes of keys w/metadata. Single item and array structs and interfaces are defined in this PR.)
  • Manufacturing config (optional, bytes)
  • Peer signers (optional, bytes)

Due to the large scope, the final new platform claim (extension devices) as well as the new realm claim (MEC policy) for draft-ffm-rats-cca-token-03 will be added in separate PRs.

New structs and interfaces are defined for TBBRoTPKItem and TBBRoTPKItems, which are based off SwComponent and SwComponents in veraison/psatoken.

Notes:

  • This PR allows an empty array for TBB ROTPK, even though the spec says it should have at least 1 item if specified. This follows the approach for SwComponents as implemented in psatoken and reused here.
  • A local type claimsV2 is defined here to allow CBOR/JSON marshaling and unmarshaling. Unfortunately, the approach used for V1 doesn't work out of the box, so the implementation here is more complicated. (Defining "type claimsV2 ClaimsV2" leads to unwanted inheritance of Claims.UnmarshalCBOR/JSON and MarshalCBOR/JSON).
  • ClientID is always 1. Its type is int32 to be consistent with psatoken, which already defines a ClientID field.

For discussion:

  • Whether to have this isNilRotPKItem function, which psatoken.SwComponents doesn't have. The reflect.ValueOf(k).Kind() == reflect.Ptr check allows this new test to pass while it would fail with runtime error if we just checked (item == nil). A corresponding test for psatoken.SwComponents would fail.
  • Whether TBBRoTPKItems should be a parametrised type like SwComponents, or just use TBBRoTPKItem as the contained type like currently in this PR.
  • Naming scheme: my current naming scheme (ClaimsV2, ProfileV2, ProfileNameV2 etc.) differs from the psatoken naming scheme (P2Claims, Profile2, Profile2Name). The context is slightly different from psatoken though, as our earlier version of claims here are simply called "Claims" whereas they are more helpfully called "P1Claims" in psatoken.

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary

Note: No updates to README here, I think we should update in 1 shot when all the platform and realm claims are updated to this new profile.

hqrui added 5 commits July 6, 2026 15:15
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
@hqrui
hqrui force-pushed the platform-claims-2.0.0 branch from b687776 to 19d5ead Compare July 6, 2026 14:15
hqrui added 5 commits July 6, 2026 17:15
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Comment thread platform/tbb_rotpkey.go Outdated
// TBBRoTPKey represents a single item in the CCA platform TBB ROTPK claim.
type TBBRoTPKey struct {
Name *string `cbor:"1,keyasint" json:"description"` // e.g. "CM" or "DM"
ActiveArray *int32 `cbor:"2,keyasint" json:"active-array"` // active ROTPK array

@hqrui hqrui Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ActiveArrayIndex and active-array-index for JSON

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

changed

Comment thread platform/tbb_rotpkey.go Outdated
import "github.com/veraison/psatoken"

// TBBRoTPKey represents a single item in the CCA platform TBB ROTPK claim.
type TBBRoTPKey struct {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
type TBBRoTPKey struct {
type TBBRoTPKItem struct {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

changed

Comment thread platform/tbb_rotpkey.go Outdated

// TBBRoTPKey represents a single item in the CCA platform TBB ROTPK claim.
type TBBRoTPKey struct {
Name *string `cbor:"1,keyasint" json:"description"` // e.g. "CM" or "DM"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Must be CM or DM case insensitive

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Error message: expected CM or DM but received ...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

added

hqrui added 16 commits July 8, 2026 10:40
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
…ken/(i)swcomponents.go

Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
…ners. Fix tests.

Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
…ed' errors to claims v1.

Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
hqrui added 11 commits July 10, 2026 09:35
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
@hqrui hqrui changed the title Platform claims 2.0.0 feat(platform): Add 4 new platform claims Jul 13, 2026
@hqrui hqrui changed the title feat(platform): Add 4 new platform claims feat(platform): Add 4 new platform claims for draft-ffm-rats-cca-token-03 Jul 13, 2026
hqrui added 4 commits July 13, 2026 15:38
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Comment thread platform/claims_v2.go
return newClaimsV2()
}

type addedClaimsV2 struct {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

consider new name

Comment thread platform/claims_v2.go Outdated
addedClaimsV2
}

func toPlainClaimsV2(c ClaimsV2) plainClaimsV2 {

@hqrui hqrui Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

to double check cbor (edit: checked 2 encoded cbors on cbor.me)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

to change to pass as pointer (linter below), change types used in invocation

Comment thread platform/claims_v2.go
}

// MarshalJSON encodes the claims into JSON
func (c ClaimsV2) MarshalJSON() ([]byte, error) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

check if can pass by pointer

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

the existing claims V1 in main also passes by value, not pointer

Since ClaimsV2.MarshalJSON is intended to override Claims.MarshalJSON, let's keep the parameter type the same (value not pointer)

hqrui added 5 commits July 14, 2026 11:31
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
…tr instead of reusing v1 test variables

Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
@hqrui
hqrui marked this pull request as ready for review July 15, 2026 13:47
Signed-off-by: Qirui Huang <qirui.huang@arm.com>
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.

1 participant