Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/attestation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ x509-parser = "0.18.0"
thiserror = "2.0.17"
anyhow = "1.0.100"
pem-rfc7468 = { version = "0.7.0", features = ["std"] }
configfs-tsm = "0.0.2"
tdx-attest = { git = "https://github.com/Dstack-TEE/dstack.git", rev = "4f602dddc0542cd34da031c90ac0b3a560f316ed" }
rand_core = { version = "0.6.4", features = ["getrandom"] }
dcap-qvl = { workspace = true, features = ["danger-allow-tcb-override"] }
hex = "0.4.3"
Expand Down
4 changes: 3 additions & 1 deletion crates/attestation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ Google Cloud metadata API is used to detect whether we are on Google Cloud.
In the case of attestation types `dcap-tdx`, `gcp-tdx`, and `qemu-tdx`, a
standard DCAP attestation is generated using the `configfs-tsm` linux filesystem
interface. This means that the binary must be run with access to
`/sys/kernel/config/tsm/report` which on many systems requires sudo.
`/sys/kernel/config/tsm/report` which on many systems requires sudo. If
configfs-tsm is unavailable, quote generation via vSOCK to the QGS will be
attempted.

Alternatively, an external 'attestation provider service' URL can be provided
which outsources the attestation generation to another process.
Expand Down
9 changes: 4 additions & 5 deletions crates/attestation/src/dcap.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Data Center Attestation Primitives (DCAP) evidence generation and
//! verification
use configfs_tsm::QuoteGenerationError;
use dcap_qvl::{
QuoteCollateralV3,
collateral::get_collateral_for_fmspc,
Expand All @@ -19,7 +18,7 @@ const AZURE_BAD_FMSPC: &str = "90C06F000000";
/// For fetching collateral directly from Intel, if no PCCS is specified
pub const PCS_URL: &str = "https://api.trustedservices.intel.com";

/// Quote generation using configfs_tsm
/// Quote generation using tdx-attest
pub fn create_dcap_attestation(input_data: [u8; 64]) -> Result<Vec<u8>, AttestationError> {
let quote = generate_quote(input_data)?;
tracing::info!("Generated TDX quote of {} bytes", quote.len());
Expand Down Expand Up @@ -234,7 +233,7 @@ pub fn verify_dcap_attestation_sync(

/// Create a mock quote for testing on non-confidential hardware
#[cfg(any(test, feature = "mock"))]
fn generate_quote(input: [u8; 64]) -> Result<Vec<u8>, QuoteGenerationError> {
fn generate_quote(input: [u8; 64]) -> Result<Vec<u8>, tdx_attest::TdxAttestError> {
let attestation_key = tdx_quote::SigningKey::random(&mut rand_core::OsRng);
let provisioning_certification_key = tdx_quote::SigningKey::random(&mut rand_core::OsRng);
Ok(tdx_quote::Quote::mock(
Expand All @@ -248,8 +247,8 @@ fn generate_quote(input: [u8; 64]) -> Result<Vec<u8>, QuoteGenerationError> {

/// Create a quote
#[cfg(not(any(test, feature = "mock")))]
fn generate_quote(input: [u8; 64]) -> Result<Vec<u8>, QuoteGenerationError> {
configfs_tsm::create_tdx_quote(input)
fn generate_quote(input: [u8; 64]) -> Result<Vec<u8>, tdx_attest::TdxAttestError> {
tdx_attest::get_quote(&input)
}

/// Given a [Report] get the input data regardless of report type
Expand Down
6 changes: 3 additions & 3 deletions crates/attestation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl AttestationType {
}
// Otherwise try DCAP quote - this internally checks that the quote provider
// is `tdx_guest`
if configfs_tsm::create_tdx_quote([0; 64]).is_ok() {
if tdx_attest::get_quote(&[0; 64]).is_ok() {
if running_on_gcp().await? {
return Ok(AttestationType::GcpTdx);
} else {
Expand Down Expand Up @@ -572,8 +572,8 @@ pub enum AttestationError {
X509(#[from] x509_parser::error::X509Error),
#[error("Configuration mismatch - expected no remote attestation")]
AttestationGivenWhenNoneExpected,
#[error("Configfs-tsm quote generation: {0}")]
QuoteGeneration(#[from] configfs_tsm::QuoteGenerationError),
#[error("TDX quote generation: {0}")]
QuoteGeneration(#[from] tdx_attest::TdxAttestError),
#[error("DCAP verification: {0}")]
DcapVerification(#[from] DcapVerificationError),
#[error("Attestation type not supported")]
Expand Down
Loading