Files
Sammy Kerata Oina c1cbcec851
CI / lint (push) Has been cancelled
CI / test (agent) (push) Has been cancelled
CI / test (cli) (push) Has been cancelled
CI / test (cmd) (push) Has been cancelled
CI / test (internal) (push) Has been cancelled
CI / test (manager, true) (push) Has been cancelled
CI / test (pkg) (push) Has been cancelled
CI / upload-coverage (push) Has been cancelled
COCOS-577 - Introduce Go-based CoRIM generation and deprecate Rust attestation policy scripts. (#578)
* feat: Introduce Go-based CoRIM generation and deprecate Rust attestation policy scripts.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* feat: Update dependencies and refactor attestation policy handling

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* refactor: Migrate attestation verification to use CoRIM and remove deprecated policy handling and EAT verification tests.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* Removed the `tdx` and `sev-snp` attestation policy scripts and their build configurations, along with related build and installation steps from the main Makefile.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* chore: Remove Rust CI workflow and Cargo Dependabot configuration, and enhance Go test setup for attestation policy paths.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* refactor: Use WriteString instead of Write([]byte) for writing policy file content in test.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* feat: Refactor `ca-bundle` command to fetch bundles by product string using a configurable HTTP getter with improved error handling, and simplify `attestation_policy` command usage.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* fix: ignore return value of cmd.Help()

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* feat: Implement CoRIM generation for Azure and GCP attestation policies and add a CLI command to download and verify GCP OVMF files.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* feat: Upgrade Python virtual environment setup to include setuptools and wheel, append computation ID to Docker container names, and improve test robustness with error assertions and conditional skips for runtime tests.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* test: Enhance attestation verification tests, including CoRIM integration and specific platform types like Azure SNP, vTPM, TDX, and IGVM.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* feat: Add comprehensive test cases for `VerifyWithCoRIM` including success and measurement mismatch, and refine reference value validation.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* feat: Add Azure and TDX attestation verification tests and abstract external service dependencies for improved testability.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* feat: Add new test cases for Azure measurement extraction, EAT platform types, IGVM measurement stopping, vTPM CoRIM verification, and GCP OVMF download CLI.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* test: enhance CLI CoRIM generation and ATLS certificate verification tests, and refactor the Azure MAA client to use an interface.

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

---------

Signed-off-by: Sammy Oina <sammyoina@gmail.com>
2026-03-19 17:01:24 +01:00

2.9 KiB

CoRIM Generator Package

The generator package provides a unified interface for generating CoRIM (Concise Reference Integrity Manifest) attestation policies for different TEE platforms.

Overview

This package consolidates CoRIM generation logic for SNP and TDX platforms, providing consistent defaults and behavior that matches legacy attestation policy generation scripts.

Features

  • Platform Support: SNP (AMD SEV-SNP) and TDX (Intel TDX)
  • Legacy Defaults: Maintains compatibility with legacy Rust SNP and Go TDX policy scripts
  • Flexible Configuration: Supports custom measurements, policies, and platform-specific parameters
  • CBOR Output: Generates CoRIM in CBOR format for standardized attestation

Usage

Basic Example

import "github.com/ultravioletrs/cocos/pkg/attestation/generator"

// Generate SNP CoRIM with defaults
opts := generator.Options{
    Platform: "snp",
    Product:  "Milan",
}
corimBytes, err := generator.GenerateCoRIM(opts)
if err != nil {
    // handle error
}

SNP with Custom Values

opts := generator.Options{
    Platform:    "snp",
    Measurement: "abc123...", // hex string
    Product:     "Genoa",
    SVN:         1,
    Policy:      0x30000,
    HostData:    "deadbeef", // hex string
    LaunchTCB:   1,
}
corimBytes, err := generator.GenerateCoRIM(opts)

TDX with Custom Values

opts := generator.Options{
    Platform:    "tdx",
    Measurement: "def456...", // MRTD hex string
    SVN:         2,
    RTMRs:       "rtmr0,rtmr1,rtmr2,rtmr3", // comma-separated hex
    MrSeam:      "789abc...", // hex string
}
corimBytes, err := generator.GenerateCoRIM(opts)

Options

Common Fields

  • Platform (string): Platform type - "snp" or "tdx"
  • Measurement (string): Hex-encoded measurement (defaults provided if empty)
  • SVN (uint64): Security Version Number

SNP-Specific Fields

  • Product (string): Processor product name (e.g., "Milan", "Genoa")
  • Policy (uint64): SNP policy flags
  • HostData (string): Hex-encoded host data
  • LaunchTCB (uint64): Minimum launch TCB version

TDX-Specific Fields

  • RTMRs (string): Comma-separated hex-encoded RTMRs
  • MrSeam (string): Hex-encoded MRSEAM value

Default Values

SNP Defaults

  • Measurement: 48 bytes of zeros (if not provided)
  • Product: "Milan"
  • SVN: 0
  • Policy: 0

TDX Defaults

  • Measurement (MRTD): 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  • MRSEAM: 2fd279c16164a93dd5bf373d834328d46008c2b693af9ebb865b08b2ced320c9a89b4869a9fab60fbe9d0c5a5363c656
  • RTMRs: Four 48-byte zero values
  • SVN: 0

Integration

This package is used by:

  • CLI: cocos-cli policy create-corim snp/tdx commands
  • Manager: Dynamic CoRIM generation in FetchAttestationPolicy
  • Scripts: scripts/corim_gen standalone tool

See Also