Skip to content

Implementation of evidence generation library in RUST#1

Merged
thomas-fossati merged 5 commits into
veraison:mainfrom
MonakaResearch:main
Jul 1, 2026
Merged

Implementation of evidence generation library in RUST#1
thomas-fossati merged 5 commits into
veraison:mainfrom
MonakaResearch:main

Conversation

@shefali-kamal

Copy link
Copy Markdown
Collaborator

This PR adds following features:

Interfaces:

  • A TSM report builder abstraction (non-dyn compatible).
  • Attester (which is dyn compatible)

Implementations:

  • LinuxTsmReportBuilder: implementation of tsm report interface for linux configfs-tsm ABI
  • CcaTsmAttester: Attester for CCA using linux tsm report builder
  • Generic RatsdAttester: posts a challenge to a RATSD daemon and returns the raw JSON response. No TEE-specific parsing.
  • CcaRatsdAttester: wraps RatsdAttester with CCA-specific CMW envelope parsing and evidence extraction.
  • Add CCA token decode and pretty-print utilities for ARM CCA
  • Add for ARM CCA UT for all the above features.

Signed-off-by: Thomas Fossati <thomas.fossati@linaro.org>
Comment thread src/attesters/cca/mod.rs Outdated
use simulated::FakeTsmBuilder;

/// Arm CCA nonce size in bytes, as required by the CCA specification.
///

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In general, looks good but it is more advisable to use:
https://datatracker.ietf.org/doc/draft-ffm-rats-cca-token/
for any CCA Claims reference

Comment thread README.md
use regl::attesters::{cca, ratsd, Attester};
use url::Url;

// Generic RATSD — explicit URL required

@yogeshbdeshpande yogeshbdeshpande Jun 23, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@shefali-kamal May be I am missing something here, but I see the same URL in

  1. Generic RATSD (where explicit URL is required )&
  2. CCA specific RATSD

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The evidence returned by 1 is the ratsd token. The CCA specific ratsd attester extracts and returns the ccatoken present inside the ratsd evidence.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@DhanusML I am referring to comment on Line 20, where you mentioned, explicit URL is required, versus
Line 25, where also an explicit URL is required.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@yogeshbdeshpande Both attesters talk to the same RATSD server that's why the URL is identical in both examples. The RatsdAttester returns the raw ratsd JSON response, while CcaRatsdAttester wraps it and extracts just the CCA token from inside the CMW envelope.

The comment "explicit URL required" on line 20 isn't meant to contrast with the CCA variant. It's just noting that neither attester auto-discovers the RATSD endpoint or reads it from an env var; you must pass a Url explicitly via with_url(). That applies equally to both. I will add a similar comment on line 25 for consistency.

Comment thread README.md
// TSM-backed attester (requires Linux CCA TSM hardware and root/sudo)
let attester = cca::CcaTsmAttester::default();
let evidence = attester.get_evidence(&challenge).unwrap();
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A question more than a comment:

  1. Do you plan to include an example of cca-sim | CcaSimulatedAttester ?
  2. I do not see any sample JSON files in the repository, so how does the Simulator operates. Where is the source for the claims?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If the simulator hard codes the claims in the file, simulated.rs, then perhaps it would be good to feed in the data from JSON files, for easy modification of claims (as inputs) to the Simulator.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, a simulated attester implementation that builds a ccatoken using the claims list and cpak is planned for the next pull request. The current implementation returns the contents of src/attesters/cca/data/evidence.cbor.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

i would request please keep a JSON or YML schema of claims which are encoded in evidence.cbor

@sb-fuji sb-fuji Jul 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@yogeshbdeshpande In the next pull request, the simulated attester implementation will take input from user provided claims in the form of JSON file. The evidence will be created from the provided claims.

Comment thread README.md
| Attester | Struct | Backend | Description |
|---|---|---|---|
| `cca-tsm` | `CcaTsmAttester` | Linux TSM (`/sys/kernel/config/tsm`) | Talks directly to the kernel TSM interface on Arm CCA hardware. Requires root or write access to configfs-tsm. |
| `cca-ratsd` | `CcaRatsdAttester` | RATSD daemon | Posts a challenge to a [RATSD](https://github.com/veraison/ratsd) daemon, then parses the CMW envelope to extract the Arm CCA attestation token. "CCA-specific" means it knows how to find and decode CCA evidence inside the CMW — it looks for items whose content type contains `configfs-tsm` and whose provider is `arm_cca_guest`. |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just curious, the Attester at Line 10 and Line 12 can be folded into one Attester, with a simple flag at the input where the returned results can be displayed in either format..?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The example binary is currently only for arm-cca and does not expose the ratsd attester.

The goal is to abstract the different means of evidence fetching available for an attestation scheme. So ratsd and cca are implemented as two different modules, each containing their family of attester(s) that implement trait Attester<AttesterError>. Hence ratsd and cca-ratsd represent different objects at the top level and the example cli should reflect this.

Maybe when the example binary starts to expose other schemes, the interface can be something like: attester <scheme-name> <mode> [options]. But right now it is cca-attester <mode> [options].

Comment thread README.md
| `cca-ratsd` | `CcaRatsdAttester` | RATSD daemon | Posts a challenge to a [RATSD](https://github.com/veraison/ratsd) daemon, then parses the CMW envelope to extract the Arm CCA attestation token. "CCA-specific" means it knows how to find and decode CCA evidence inside the CMW — it looks for items whose content type contains `configfs-tsm` and whose provider is `arm_cca_guest`. |
| `cca-sim` | `CcaSimulatedAttester` | Embedded blob | Returns a pre-built CCA token embedded at compile time. Useful for testing and development without hardware or a running RATSD. |
| `ratsd` | `RatsdAttester` | RATSD daemon (generic) | Posts a challenge to a RATSD daemon and returns the raw JSON response as-is. No TEE-specific parsing — use this if you want the CMW envelope or other RATSD-level data directly. |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there a plan to add support for validating or checking the token, meaning:

  1. Verifying that Valid Claims exist in the token..?
  2. Verifying the signature on the token, to check the Crypto is correct..?
    Such tooling will be beneficial in the community!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

veraison/rust-ccatoken has both these features. This library (rust-regl) is only for fetching evidence and treats evidence as opaque bytestring (except the pretty-print function, which uses veraison/rust-ccatoken to deserialize the token, but does not perform any cryptographic checks).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Yes, I am aware that the rust/ccatoken library provides an API for integration of ccatoken verification.

My question was more of a CLI tooling which is your focus and a CLI tool for easy and handy Crypto Verification of CCA Evidence (please see an equivalent golang implementation in veraison/evcli )

@sb-fuji sb-fuji Jul 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@yogeshbdeshpande I understand that you're asking about a CLI that does full cryptographic verification (signature check, claim validation), similar to what evcli does in Go. That is currently out of scope for rust-regl, which is purely an evidence gathering library (fetch, don't verify). The verification piece lives in veraison/rust-ccatoken, which already has the APIs for decoding and crypto checks. A separate CLI binary that wraps rust-ccatoken for verification can be the right place for that. We can track it as a follow-up issue if there's interest.

@yogeshbdeshpande

Copy link
Copy Markdown

@shefali-kamal : Thanks for the great work, this is quite useful.

Once the PR is merged, as new useful repository will be added. kindly remember to add this repo in the list
here

@thomas-fossati thomas-fossati left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very good stuff, thanks!

I have left a few comments inline.

Comment thread src/tsm/linuxtsm.rs
Comment thread src/tsm/linuxtsm.rs
Comment thread src/attesters/cca/ratsd.rs Outdated
Comment thread src/attesters/cca/utils/decode.rs Outdated
Comment thread src/attesters/cca/mod.rs Outdated
DhanusML and others added 4 commits June 24, 2026 14:53
Contains definitions of all interfaces. Also contains
working examples demonstrating the usage.

Interfaces:
1. A TSM report builder abstraction (non-dyn compatible).
2. Attester (which is dyn compatible)

Implementations:
1. LinuxTsmReportBuilder: implementation of tsm report
interface for linux configfs-tsm ABI

2. CcaTsmAttester: Attester for CCA using linux tsm
report builder

3. CcaSimAttester: Attester for CCA which generates
simulated evidence.

The intented usage of the TSM report builder interface
is to mock configfs-tsm behaviours. This can be seen in
the implementation of the FakeTsmBuilder, which is used
by CcaSimAttester.

Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Add attester trait and implementations for CCA evidence collection:

- Generic RatsdAttester (src/attesters/ratsd.rs): HTTP transport layer
  that posts a challenge to a RATSD daemon and returns the raw JSON
  response. No TEE-specific parsing.
- CcaRatsdAttester (src/attesters/cca/ratsd.rs): wraps RatsdAttester
  with CCA-specific CMW envelope parsing and evidence extraction.
  Reuses cmw::monad::Monad directly, collects evidence from
  Linux configfs-tsm on real CCA hardware.
- CcaSimulatedAttester returns embedded pre-built evidence.cbor.

Includes example binary (examples/attester.rs) supporting
--attester cca-tsm|cca-sim|cca-ratsd.

Add tests for CCA attesters (nonce validation, CMW parsing, error paths),
RatsdAttester httpmock round-trip, simulated CCA backend, and TSM error
type conversions and context() behavior.

Signed-off-by: BISWAS, SREYAN <SREYAN.BISWAS@fujitsu.com>
[Dhanus.MLal@fujitsu.com: resolved conflicts in deny.toml]
Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
Add util submodule for decoding and displaying CCA attestation tokens:

- types.rs: serde-annotated CcaToken, PlatformClaims, RealmClaims,
  SwComponent structs with base64 field serialization
- decode.rs: decode_cca_token() delegates to ccatoken::Evidence::decode,
  then converts to REGL's serde-enabled types
- print.rs: pretty_print_token() for human-readable JSON output
  matching evcli cca print format
- examples/attester.rs: add --print flag with pretty_print_token

Add tests for CBOR decode pipeline, pretty-print JSON output,
and CcaToken serde round-trip.

Add ccatoken, serde, ciborium dependencies needed by the utils.

Signed-off-by: BISWAS, SREYAN <SREYAN.BISWAS@fujitsu.com>
Signed-off-by: Dhanus M Lal <Dhanus.MLal@fujitsu.com>
@yogeshbdeshpande

Copy link
Copy Markdown

@DhanusML, @shefali-kamal Do you have a equivalent github issue, which captures the requirement or the problem space, which you are trying to solve using this PR?

@thomas-fossati thomas-fossati left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks!

@shefali-kamal

Copy link
Copy Markdown
Collaborator Author

@DhanusML, @shefali-kamal Do you have a equivalent github issue, which captures the requirement or the problem space, which you are trying to solve using this PR?

@yogeshbdeshpande as of now we have not created any GH Issue/enhancement for this.

@shefali-kamal

Copy link
Copy Markdown
Collaborator Author

@shefali-kamal : Thanks for the great work, this is quite useful.

Once the PR is merged, as new useful repository will be added. kindly remember to add this repo in the list here

Yes @yogeshbdeshpande we will make sure to add this. Once you approve the PR I will merge it and add the details in the repo list.

@yogeshbdeshpande yogeshbdeshpande 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.

LGTM!

Since this is very much a Work In Progress, where more items are required before we mark this as complete, I would request implementer of the PR to make a note of the changes requested in the comments either via github issue or some other tracking mechanism and then merge the changes for this PR!

@thomas-fossati

Copy link
Copy Markdown
Contributor

@paulhowardarm do you plan to provide your review?

If not, I believe it can be merged.

@paulhowardarm

Copy link
Copy Markdown

@paulhowardarm do you plan to provide your review?

If not, I believe it can be merged.

@thomas-fossati Two approvals is sufficient, I think, so please feel free to go ahead and merge. Thanks to all contributors and reviewers for the excellent work here.

@thomas-fossati
thomas-fossati merged commit 76aafee into veraison:main Jul 1, 2026
4 checks passed
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.

6 participants