Merge pull request #310 from matter-labs/add-dcap-collateral-updater

feat(teepot): add `Quote::tee_type` method for TEE type determination
This commit is contained in:
Harald Hoyer 2025-05-06 13:46:58 +02:00 committed by GitHub
commit 336576d812
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -575,6 +575,22 @@ impl Quote {
Ok(quote)
}
/// Returns the TEE type of this quote.
///
/// The TEE type is extracted from the quote header and can be either SGX or TDX for now.
/// Due to validation during quote parsing, this is guaranteed to return only
/// valid TEE types.
pub fn tee_type(&self) -> TEEType {
match self.header.tee_type {
TEE_TYPE_SGX => TEEType::SGX,
TEE_TYPE_TDX => TEEType::TDX,
// Creating `Self` via `parse()`,
// should guarantee that the TEE type
// is nothing else than SGX or TDX
_ => unreachable!(),
}
}
/// Get the raw certificate chain from the quote.
pub fn raw_cert_chain(&self) -> Result<&[u8], QuoteError> {
let cert_data = match &self.auth_data {