Support intel-dcap-1.16
diff --git a/sgx_types/src/error.rs b/sgx_types/src/error.rs
index e63093c..812b50c 100644
--- a/sgx_types/src/error.rs
+++ b/sgx_types/src/error.rs
@@ -482,6 +482,7 @@
SGX_QL_INTERNAL_SERVER_ERROR = 0x0000_E063,
SGX_QL_SUPPLEMENTAL_DATA_VERSION_NOT_SUPPORTED = 0x0000_E064,
SGX_QL_ROOT_CA_UNTRUSTED = 0x0000_E065,
+ SGX_QL_TCB_NOT_SUPPORTED = 0x0000_E066,
SGX_QL_ERROR_MAX = 0x0000_E0FF,
}
}
@@ -641,6 +642,9 @@
sgx_quote3_error_t::SGX_QL_ROOT_CA_UNTRUSTED => {
"The certificate used to establish SSL session is untrusted"
}
+ sgx_quote3_error_t::SGX_QL_TCB_NOT_SUPPORTED => {
+ "Current TCB level cannot be found in platform/enclave TCB info"
+ }
sgx_quote3_error_t::SGX_QL_ERROR_MAX => {
"Indicate max error to allow better translation."
}
@@ -793,6 +797,7 @@
"SGX_QL_SUPPLEMENTAL_DATA_VERSION_NOT_SUPPORTED"
}
sgx_quote3_error_t::SGX_QL_ROOT_CA_UNTRUSTED => "SGX_QL_ROOT_CA_UNTRUSTED",
+ sgx_quote3_error_t::SGX_QL_TCB_NOT_SUPPORTED => "SGX_QL_TCB_NOT_SUPPORTED",
sgx_quote3_error_t::SGX_QL_ERROR_MAX => "SGX_QL_ERROR_MAX",
}
}
@@ -999,6 +1004,94 @@
}
}
+impl_enum! {
+ #[repr(u32)]
+ #[derive(Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Debug)]
+ pub enum tdx_attest_error_t {
+ TDX_ATTEST_SUCCESS = 0x0000_0000,
+ // TDX_ATTEST_ERROR_MIN = 0x0000_0001,
+ TDX_ATTEST_ERROR_UNEXPECTED = 0x0000_0001,
+ TDX_ATTEST_ERROR_INVALID_PARAMETER = 0x0000_0002,
+ TDX_ATTEST_ERROR_OUT_OF_MEMORY = 0x0000_0003,
+ TDX_ATTEST_ERROR_VSOCK_FAILURE = 0x0000_0004,
+ TDX_ATTEST_ERROR_REPORT_FAILURE = 0x0000_0005,
+ TDX_ATTEST_ERROR_EXTEND_FAILURE = 0x0000_0006,
+ TDX_ATTEST_ERROR_NOT_SUPPORTED = 0x0000_0007,
+ TDX_ATTEST_ERROR_QUOTE_FAILURE = 0x0000_0008,
+ TDX_ATTEST_ERROR_BUSY = 0x0000_0009,
+ TDX_ATTEST_ERROR_DEVICE_FAILURE = 0x0000_000A,
+ TDX_ATTEST_ERROR_INVALID_RTMR_INDEX = 0x0000_000B,
+ TDX_ATTEST_ERROR_UNSUPPORTED_ATT_KEY_ID = 0x0000_000C,
+ TDX_ATTEST_ERROR_MAX = 0x0000_000D,
+ }
+}
+
+impl tdx_attest_error_t {
+ pub fn __description(&self) -> &'static str {
+ match *self {
+ tdx_attest_error_t::TDX_ATTEST_SUCCESS => "Success.",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_UNEXPECTED => "Unexpected error.",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_INVALID_PARAMETER => "The parameter is incorrect.",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_OUT_OF_MEMORY => {
+ "Not enough memory is available to complete this operation."
+ }
+ tdx_attest_error_t::TDX_ATTEST_ERROR_VSOCK_FAILURE => {
+ "vsock related failure."
+ }
+ tdx_attest_error_t::TDX_ATTEST_ERROR_REPORT_FAILURE => "Failed to get the TD Report.",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_EXTEND_FAILURE => "Failed to extend rtmr.",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_NOT_SUPPORTED => {
+ "Request feature is not supported."
+ }
+ tdx_attest_error_t::TDX_ATTEST_ERROR_QUOTE_FAILURE => {
+ "Failed to get the TD Quote."
+ }
+ tdx_attest_error_t::TDX_ATTEST_ERROR_BUSY => "The device driver return busy.",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_DEVICE_FAILURE => "Failed to acess tdx attest device.",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_INVALID_RTMR_INDEX => "Only supported RTMR index is 2 and 3.",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_UNSUPPORTED_ATT_KEY_ID => "The platform Quoting infrastructure does not support any of the keys described in att_key_id_list.",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_MAX => "Indicate max error.",
+ }
+ }
+
+ pub fn as_str(&self) -> &'static str {
+ match *self {
+ tdx_attest_error_t::TDX_ATTEST_SUCCESS => "TDX_ATTEST_SUCCESS",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_UNEXPECTED => "TDX_ATTEST_ERROR_UNEXPECTED",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_INVALID_PARAMETER => {
+ "TDX_ATTEST_ERROR_INVALID_PARAMETER"
+ }
+ tdx_attest_error_t::TDX_ATTEST_ERROR_OUT_OF_MEMORY => "TDX_ATTEST_ERROR_OUT_OF_MEMORY",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_VSOCK_FAILURE => "TDX_ATTEST_ERROR_VSOCK_FAILURE",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_REPORT_FAILURE => {
+ "TDX_ATTEST_ERROR_REPORT_FAILURE"
+ }
+ tdx_attest_error_t::TDX_ATTEST_ERROR_EXTEND_FAILURE => {
+ "TDX_ATTEST_ERROR_EXTEND_FAILURE"
+ }
+ tdx_attest_error_t::TDX_ATTEST_ERROR_NOT_SUPPORTED => "TDX_ATTEST_ERROR_NOT_SUPPORTED",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_QUOTE_FAILURE => "TDX_ATTEST_ERROR_QUOTE_FAILURE",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_BUSY => "TDX_ATTEST_ERROR_BUSY",
+ tdx_attest_error_t::TDX_ATTEST_ERROR_DEVICE_FAILURE => {
+ "TDX_ATTEST_ERROR_DEVICE_FAILURE"
+ }
+ tdx_attest_error_t::TDX_ATTEST_ERROR_INVALID_RTMR_INDEX => {
+ "TDX_ATTEST_ERROR_INVALID_RTMR_INDEX"
+ }
+ tdx_attest_error_t::TDX_ATTEST_ERROR_UNSUPPORTED_ATT_KEY_ID => {
+ "TDX_ATTEST_ERROR_UNSUPPORTED_ATT_KEY_ID"
+ }
+ tdx_attest_error_t::TDX_ATTEST_ERROR_MAX => "TDX_ATTEST_ERROR_MAX",
+ }
+ }
+}
+
+impl fmt::Display for tdx_attest_error_t {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{}", self.as_str())
+ }
+}
+
pub type sys_error_t = int32_t;
pub type SgxResult<T> = result::Result<T, sgx_status_t>;
diff --git a/sgx_types/src/function.rs b/sgx_types/src/function.rs
index 8101324..db6c77c 100644
--- a/sgx_types/src/function.rs
+++ b/sgx_types/src/function.rs
@@ -711,7 +711,8 @@
) -> int32_t;
pub fn sgx_mm_uncommit(addr: *const c_void, length: size_t) -> int32_t;
pub fn sgx_mm_dealloc(addr: *const c_void, length: size_t) -> int32_t;
- pub fn sgx_mm_modify_permissions(addr: *const c_void, length: size_t, prot: int32_t) -> int32_t;
+ pub fn sgx_mm_modify_permissions(addr: *const c_void, length: size_t, prot: int32_t)
+ -> int32_t;
pub fn sgx_mm_modify_type(addr: *const c_void, length: size_t, page_type: int32_t) -> int32_t;
}
@@ -1280,6 +1281,14 @@
p_qve_report_info: *mut sgx_ql_qe_report_info_t,
p_supp_data_descriptor: *const tee_supp_data_descriptor_t,
) -> sgx_quote3_error_t;
+
+ /* intel DCAP 1.16 */
+ pub fn tee_get_fmspc_from_quote(
+ p_quote: *const uint8_t,
+ quote_size: uint32_t,
+ p_fmspc_from_quote: *mut uint8_t,
+ fmspc_from_quote_size: uint32_t,
+ ) -> sgx_quote3_error_t;
}
/* intel DCAP 1.7 */
@@ -1301,6 +1310,37 @@
) -> sgx_quote3_error_t;
}
+/* intel DCAP 1.15 */
+//#[link(name = "libtdx_attest")]
+extern "C" {
+ //
+ // tdx_attes.h
+ //
+ pub fn tdx_att_get_quote(
+ p_tdx_report_data: *const tdx_report_data_t,
+ att_key_id_list: *const tdx_uuid_t,
+ list_size: uint32_t,
+ p_att_key_id: *mut tdx_uuid_t,
+ pp_quote: *mut *mut uint8_t,
+ p_quote_size: *mut uint32_t,
+ flags: uint32_t,
+ ) -> tdx_attest_error_t;
+
+ pub fn tdx_att_free_quote(p_quote: *const uint8_t) -> tdx_attest_error_t;
+
+ pub fn tdx_att_get_report(
+ p_tdx_report_data: *const tdx_report_data_t,
+ p_tdx_report: *mut tdx_report_t,
+ ) -> tdx_attest_error_t;
+
+ pub fn tdx_att_extend(p_rtmr_event: *const tdx_rtmr_event_t) -> tdx_attest_error_t;
+
+ pub fn tdx_att_get_supported_att_key_ids(
+ p_att_key_id_list: *mut tdx_uuid_t,
+ p_list_size: *mut uint32_t,
+ ) -> tdx_attest_error_t;
+}
+
/* intel sgx sdk 2.16 */
//#[link(name = "sgx_ttls")]
extern "C" {
diff --git a/sgx_types/src/types.rs b/sgx_types/src/types.rs
index a5a10bb..decd4a0 100644
--- a/sgx_types/src/types.rs
+++ b/sgx_types/src/types.rs
@@ -1752,6 +1752,59 @@
}
}
+/* intel DCAP 1.15 */
+//
+// tdx_attes.h
+//
+pub const TDX_UUID_SIZE: usize = 16;
+pub const TDX_REPORT_DATA_SIZE: usize = 64;
+pub const TDX_REPORT_SIZE: usize = 1024;
+
+impl_struct! {
+ pub struct tdx_uuid_t {
+ pub d: [uint8_t; TDX_UUID_SIZE],
+ }
+}
+
+impl_copy_clone! {
+ pub struct tdx_report_data_t {
+ pub d: [uint8_t; TDX_REPORT_DATA_SIZE],
+ }
+
+ pub struct tdx_report_t {
+ pub d: [uint8_t; TDX_REPORT_SIZE],
+ }
+}
+
+impl_struct_default! {
+ tdx_report_data_t; //64
+ tdx_report_t; //1024
+}
+
+impl_struct_ContiguousMemory! {
+ tdx_report_data_t;
+ tdx_report_t;
+}
+
+impl_packed_copy_clone! {
+ pub struct tdx_rtmr_event_t {
+ pub version: uint32_t,
+ pub rtmr_index: uint64_t,
+ pub extend_data: [uint8_t; 48],
+ pub event_type: uint32_t,
+ pub event_data_size: uint32_t,
+ pub event_data: [uint8_t; 0],
+ }
+}
+
+impl_struct_default! {
+ tdx_rtmr_event_t; //68
+}
+
+impl_struct_ContiguousMemory! {
+ tdx_rtmr_event_t;
+}
+
/* intel sgx sdk 2.7.1 */
//
// sgx_secure_align_api.h