Implementation of evidence generation library in RUST#1
Conversation
| use simulated::FakeTsmBuilder; | ||
|
|
||
| /// Arm CCA nonce size in bytes, as required by the CCA specification. | ||
| /// |
There was a problem hiding this comment.
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
| use regl::attesters::{cca, ratsd, Attester}; | ||
| use url::Url; | ||
|
|
||
| // Generic RATSD — explicit URL required |
There was a problem hiding this comment.
@shefali-kamal May be I am missing something here, but I see the same URL in
- Generic RATSD (where explicit URL is required )&
- CCA specific RATSD
There was a problem hiding this comment.
The evidence returned by 1 is the ratsd token. The CCA specific ratsd attester extracts and returns the ccatoken present inside the ratsd evidence.
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
@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.
| // TSM-backed attester (requires Linux CCA TSM hardware and root/sudo) | ||
| let attester = cca::CcaTsmAttester::default(); | ||
| let evidence = attester.get_evidence(&challenge).unwrap(); | ||
| ``` |
There was a problem hiding this comment.
A question more than a comment:
- Do you plan to include an example of
cca-sim|CcaSimulatedAttester? - I do not see any sample JSON files in the repository, so how does the Simulator operates. Where is the source for the claims?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
i would request please keep a JSON or YML schema of claims which are encoded in evidence.cbor
There was a problem hiding this comment.
@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.
| | 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`. | |
There was a problem hiding this comment.
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..?
There was a problem hiding this comment.
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].
| | `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. | | ||
|
|
There was a problem hiding this comment.
Is there a plan to add support for validating or checking the token, meaning:
- Verifying that Valid Claims exist in the token..?
- Verifying the signature on the token, to check the Crypto is correct..?
Such tooling will be beneficial in the community!
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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 )
There was a problem hiding this comment.
@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.
|
@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 |
thomas-fossati
left a comment
There was a problem hiding this comment.
Very good stuff, thanks!
I have left a few comments inline.
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>
|
@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. |
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
left a comment
There was a problem hiding this comment.
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!
|
@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. |
This PR adds following features:
Interfaces:
Implementations: