Skip to content

Conversation

@jraman567
Copy link
Collaborator

This PR implements the SEVSNP scheme for Veraison.

RATSd needs golang version 1.23.0 or newer as it depends on
CMW (https://github.com/veraison/cmw), which needs 1.23.0 or newer.

The services repo needs RATSd. Therefore, set the minimum golang
version to 1.23.0

Signed-off-by: Jagannathan Raman <[email protected]>
define SEV-SNP scheme for Veraison. Switch to CoRIM version
v1.1.3-0.20250307044607-0bbdd6c78526

Signed-off-by: Jagannathan Raman <[email protected]>

fix(sensnp+rpm): add SEV-SNP plugin to package
store the trust anchors and reference values in the CoMID's
"Attest Key Triple" and "Reference Value Triple" formats.

Signed-off-by: Jagannathan Raman <[email protected]>
accept CoRIM endorsements, reference values & trust anchors,
and save them in the database.

Signed-off-by: Jagannathan Raman <[email protected]>
implement parts of the store handler that synthesize
keys from trust anchors and reference values.

Signed-off-by: Jagannathan Raman <[email protected]>
Implement an evidence handler to extract claims from the evidence token
and store them in an internal representation format ( CoRIM for SEV-SNP).

Additionally, implement the GetLevel interface for HCLogger, which was
introduced with v1.5.0.

Signed-off-by: Jagannathan Raman <[email protected]>
Update the store handler to get Trust Anchor and Reference Value
keys from evidence.

Add helper routines to parse the TSM report's auxblob to extract
AMD keys.

Signed-off-by: Jagannathan Raman <[email protected]>
Implement the ValidateEvidenceIntegrity routine of the EvidenceHandler interface.

Ensure the root key in auxblob matches the ARK in provisioned trust anchors.
Confirm the integrity of the certificate chain in the auxblob and the
validity of the signature in the evidence.

Signed-off-by: Jagannathan Raman <[email protected]>
Implement the AppraiseEvidence routine in the EvidenceHandler interface
to confirm the claims match with the evidence.

Signed-off-by: Jagannathan Raman <[email protected]>
Add unit tests for endorsement, evidence and storage handlers

Signed-off-by: Jagannathan Raman <[email protected]>
Add README document for SEVSNP scheme

Signed-off-by: Jagannathan Raman <[email protected]>
Update the CMW module to enable CMW collection support

Signed-off-by: Jagannathan Raman <[email protected]>
Update go-sev-guest to get fix for Genoa VCEK handling

Signed-off-by: Jagannathan Raman <[email protected]>
Allow SEVSNP scheme to accept evidence in CMW collection format

Signed-off-by: Jagannathan Raman <[email protected]>
REPORTED_TCB is a bitfield of versions. Extract individual versions
for comparison. REPORTED_TCB in evidence should be greater than or
equal to the reference value.

Signed-off-by: Jagannathan Raman <[email protected]>
Some claims in the SEV-SNP profile aren't relevant for
verification, so skipping them

Signed-off-by: Jagannathan Raman <[email protected]>

block, _ := pem.Decode(cert)
if block == nil || block.Type != "CERTIFICATE" {
return nil, fmt.Errorf("failed to read certificate")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return nil, fmt.Errorf("failed to read certificate")
return nil, errors.New("failed to read certificate")

tcbParts kds.TCBParts
)

// ToDo: following is a circuitous way to obtain the 64-bit TCB integer value
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is a genuine TO DO, preferably create an issue and tag the issue here, please!

return nil, err
}

refValCorim := corim.UnsignedCorim{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

just check, if we need to initialise other mandatory part of CoRIM here as well...

Copy link
Collaborator

@yogeshbdeshpande yogeshbdeshpande left a comment

Choose a reason for hiding this comment

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

in middle of review, just started today

jraman567 and others added 5 commits September 29, 2025 10:20
Co-authored-by: Yogesh Deshpande <[email protected]>
Co-authored-by: Yogesh Deshpande <[email protected]>
Co-authored-by: Yogesh Deshpande <[email protected]>
Co-authored-by: Yogesh Deshpande <[email protected]>
Co-authored-by: Yogesh Deshpande <[email protected]>
@yogeshbdeshpande
Copy link
Collaborator

As we are adding new scheme, please refer to https://github.com/veraison/services/blob/main/README.md

  • Insert Sev-snp support in the suitable place for the text pertaining to Provisioning
  • Insert Sev-snp support in the suitable place for the text pertaining to Verification

Also remember to check the suitable places in docs repo and the Veraison book, to check where this comment is applicable.

Copy link
Collaborator

@yogeshbdeshpande yogeshbdeshpande left a comment

Choose a reason for hiding this comment

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

Left some further comments.

return block.Bytes, nil
}

func parseAttestationToken(token *proto.AttestationToken) (*tokens.TSMReport, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a question, perhaps need a better place to ask, is there a place, where, we say, the supported Media Types for Evidence are 1. TSM in CBOR, 2. TSM in JSON 3. RATSD in JSON ..?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @yogeshbdeshpande, are you asking where they are documented?

tsm-report's CDDL is here: https://github.com/veraison/ratsd/blob/main/docs/tsm-report.cddl

  1. TSM in CBOR is recorded here: https://www.iana.org/assignments/media-types/application/vnd.veraison.tsm-report+cbor

I couldn't find the IANA doc for the other two. I'll check with @thomas-fossati on how to get them.

Besides we have this godoc: https://pkg.go.dev/github.com/veraison/ratsd/attesters/tsm

Copy link
Contributor

@thomas-fossati thomas-fossati Oct 1, 2025

Choose a reason for hiding this comment

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

I couldn't find the IANA doc for the other two. I'll check with @thomas-fossati on how to get them.

TSM in JSON is recorded here: https://www.iana.org/assignments/media-types/application/vnd.veraison.tsm-report+json

RATSd evidence top-level formats are explored here: veraison/ratsd#27

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you, @thomas-fossati.

result := handler.CreateAttestationResult(SchemeName)

appraisal := result.Submods[SchemeName]

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a question: Is this init to default values or more than this..?
Can you please specify, perhaps a short comment might help as well!

// - POLICY ToDo: Do we need to test individual policy features?
// - CURRENT_TCB is informational only. It's best handled by policy
// - PLATFORM_INFO ToDO: Do we need to test individual platform features?
// - REPORT_DATA is a nonce supplied by user for freshness, not applicable for verification
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// - REPORT_DATA is a nonce supplied by user for freshness, not applicable for verification
// - REPORT_DATA is a nonce supplied by user for freshness, this is verified prior at a suitable point- functon-name()

// - REPORT_DATA is a nonce supplied by user for freshness, not applicable for verification
// - REPORT_ID is ephemeral, so we can't use it for verification.
// - REPORT_ID_MA is also ephemeral, used for migration
// - CHIP_ID is unique to an specific attester, but reference values could be used more generally
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a question:

Does the CHIP_ID maps to a specific instance of platform??? If Yes, shall we not populate the InstanceID Claims..

// ToDo: It is a good idea to test it anyway, but the Version type only tests for
// equality, and this would trigger spurious failures
// - COMMITTED_TCB is informational, used by the host to advance REPORTED_TCB
if k == mKeyPolicy ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have a question here. Should we not expect a definite set of MKeys and check for their presence here or somewhere earlier to report a fail, if a mandatory MKey is missing from Evidence?
Does this happen intrinsically inside the Evidence Decoding, then it is fine, but just checking...

break claimsLoop
}
if !compareTcb(*reportedTcb, *em) {
// ToDo: Is this a failure condition?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note: Each of these failures should be represented in the corresponding flag inside the TrustVector for Platform ? If not please check and raise a bug on AR4SI if something fundamental missing in the spec..

0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18,
}

func Test_ExtractClaims_ok(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just checking, I did not see the Full Evidence JSON Claims set in the test cases..?

is there any reason for this..?

require.NoError(t, err)
}

func Test_ValidateEvidenceIntegrity_ok(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, I saw three types of Evidence Format in the code, but I see ONLY tests with RATSD Token only,

Can you please add the test cases for TSM Report in JSON and CBOR as well ?

@yogeshbdeshpande
Copy link
Collaborator

  • Also, I feel somewhere in the documentation of the Scheme, we should refer to the documentation on the Evidence Profile and also preferably the Reference Value Profile document, we have used to build this scheme!

Copy link
Contributor

@thomas-fossati thomas-fossati left a comment

Choose a reason for hiding this comment

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

Thanks, this is great.

I have left a few comments inline.


It doesn't need any specific install instructions, it gets deployed along with other schemes.
```
make really-clean; make native-deploy
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a couple of non-blocking notes:

  1. You can supply more than one target when invoking make:
make really-clean native-deploy
  1. The ; will not stop updating native-deploy if really-clean fails, which is not what you want. Instead:
make really-clean && make native-deploy

Comment on lines +16 to +17
Since ratsd is under construction, please use the following instance of evcli to submit evidence.
https://github.com/jraman567/evcli
Copy link
Contributor

Choose a reason for hiding this comment

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

More fancy linking:

Suggested change
Since ratsd is under construction, please use the following instance of evcli to submit evidence.
https://github.com/jraman567/evcli
Since ratsd is under construction, please use the following [fork of evcli](https://github.com/jraman567/evcli) to submit Evidence.


## Usage example

Following is an example of how to interface with this scheme/plugin. The workflow involves using cocli to submit reference values and ratsd to submit the evidence.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Following is an example of how to interface with this scheme/plugin. The workflow involves using cocli to submit reference values and ratsd to submit the evidence.
Following is an example of how to interface with this scheme/plugin. The workflow involves using cocli to submit Reference Values and [ratsd](https://github.com/veraison/ratsd) to submit Evidence.

Comment on lines +19 to +21
Generating reference values and evidence is beyond this project's scope. Please see go-gen-ref for creating reference values for SEV-SNP; RATSd generates evidence.
go-gen-ref: https://github.com/jraman567/go-gen-ref
ratsd: https://github.com/veraison/ratsd
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Generating reference values and evidence is beyond this project's scope. Please see go-gen-ref for creating reference values for SEV-SNP; RATSd generates evidence.
go-gen-ref: https://github.com/jraman567/go-gen-ref
ratsd: https://github.com/veraison/ratsd
Generating Reference Values and Evidence is beyond this project's scope. Please see [go-gen-ref](https://github.com/jraman567/go-gen-ref) for creating Reference Values for SEV-SNP; ratsd generates Evidence.

```

## Attestation Result
The result is in JWT format. Decoding it using an online tool like https://jwt.io/ reveals formatted results. The trustworthiness vector, as shown below, summarizes the result of verification.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can’t we use arc to verify and print the TV?

}

if evM.Val.SVN == nil {
log.Errorf("evidence doesn't have SVN")
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

switch k {
case mKeyReportedTcb:
if !compareTcb(m, *em) {
err = fmt.Errorf("reported TCB in evidence doesn't match reference")
Copy link
Contributor

Choose a reason for hiding this comment

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

please, use errors.New()

}

if len(extractedComid.Triples.ReferenceValues.Values) > 1 {
return nil, fmt.Errorf("unable to process multiple claims in evidence")
Copy link
Contributor

Choose a reason for hiding this comment

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

please, use errors.New()


keyBlock, _ := pem.Decode([]byte(ark.String()))
if keyBlock == nil || keyBlock.Type != "CERTIFICATE" {
return nil, fmt.Errorf("failed to decode ARK")
Copy link
Contributor

Choose a reason for hiding this comment

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

usual errors.New() comment :-)

}

if m == nil {
return "", fmt.Errorf("measurement not found")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return "", fmt.Errorf("measurement not found")
return "", errors.New("measurement not found")

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.

3 participants