sgx_trts and sgx_types update to intel-2.14
diff --git a/sgx_trts/src/enclave.rs b/sgx_trts/src/enclave.rs
index 582d255..6759491 100644
--- a/sgx_trts/src/enclave.rs
+++ b/sgx_trts/src/enclave.rs
@@ -57,6 +57,9 @@
pub layout_entry_num: u32,
pub reserved: u32,
pub layout_table: [layout_t; LAYOUT_ENTRY_NUM],
+ pub enclave_image_address: u64,
+ pub elrange_start_address: u64,
+ pub elrange_size: u64,
}
#[repr(C)]
@@ -93,6 +96,8 @@
eremove_tcs_num: u32,
dyn_tcs_num: u32,
max_tcs_num: u32,
+ elrange_base: usize,
+ elrange_size: usize,
}
impl Default for SgxGlobalData {
@@ -125,6 +130,8 @@
eremove_tcs_num: eremove_num,
dyn_tcs_num: dyn_num,
max_tcs_num: rsgx_get_tcs_max_num(),
+ elrange_base: rsgx_get_elrange_base() as usize,
+ elrange_size: rsgx_get_elrange_size(),
}
}
@@ -243,6 +250,28 @@
// self.static_tcs_num + self.eremove_tcs_num
//}
}
+
+ ///
+ /// elrange_base is to get enclave range base address.
+ ///
+ /// **Note**
+ ///
+ /// This API is only an experimental funtion.
+ ///
+ pub fn elrange_base(&self) -> usize {
+ self.elrange_base
+ }
+
+ ///
+ /// elrange_size is to get enclave range size.
+ ///
+ /// **Note**
+ ///
+ /// This API is only an experimental funtion.
+ ///
+ pub fn elrange_size(&self) -> usize {
+ self.elrange_size
+ }
}
#[allow(dead_code)]
@@ -617,4 +646,28 @@
#[inline]
pub fn rsgx_get_peak_rsrv_mem_committed() -> usize {
unsafe { g_peak_rsrv_mem_committed }
-}
\ No newline at end of file
+}
+
+///
+/// rsgx_get_elrange_base is to get enclave range base address.
+///
+/// **Note**
+///
+/// This API is only an experimental funtion.
+///
+#[inline]
+pub fn rsgx_get_elrange_base() -> *const u8 {
+ unsafe { g_global_data.elrange_start_address as *const u8 }
+}
+
+///
+/// rsgx_get_elrange_size is to get enclave range size.
+///
+/// **Note**
+///
+/// This API is only an experimental funtion.
+///
+#[inline]
+pub fn rsgx_get_elrange_size() -> usize {
+ unsafe { g_global_data.elrange_size as usize }
+}
diff --git a/sgx_types/src/error.rs b/sgx_types/src/error.rs
index 51e985d..ea9a488 100755
--- a/sgx_types/src/error.rs
+++ b/sgx_types/src/error.rs
@@ -35,6 +35,7 @@
SGX_ERROR_INVALID_STATE = 0x0000_0005, /* SGX API is invoked in incorrect order or state */
SGX_ERROR_FEATURE_NOT_SUPPORTED = 0x0000_0008, /* Feature is not supported on this platform */
SGX_PTHREAD_EXIT = 0x0000_0009, /* Enclave is exited with pthread_exit() */
+ SGX_ERROR_MEMORY_MAP_FAILURE = 0x0000_000A, /* Failed to reserve memory for the enclave */
SGX_ERROR_INVALID_FUNCTION = 0x0000_1001, /* The ecall/ocall index is invalid */
SGX_ERROR_OUT_OF_TCS = 0x0000_1003, /* The enclave is out of TCS */
@@ -52,10 +53,10 @@
SGX_ERROR_NO_DEVICE = 0x0000_2006, /* Can't open SGX device */
SGX_ERROR_MEMORY_MAP_CONFLICT = 0x0000_2007, /* Page mapping failed in driver */
SGX_ERROR_INVALID_METADATA = 0x0000_2009, /* The metadata is incorrect. */
- SGX_ERROR_DEVICE_BUSY = 0x0000_200c, /* Device is busy, mostly EINIT failed. */
- SGX_ERROR_INVALID_VERSION = 0x0000_200d, /* Metadata version is inconsistent between uRTS and sgx_sign or uRTS is incompatible with current platform. */
- SGX_ERROR_MODE_INCOMPATIBLE = 0x0000_200e, /* The target enclave 32/64 bit mode or sim/hw mode is incompatible with the mode of current uRTS. */
- SGX_ERROR_ENCLAVE_FILE_ACCESS = 0x0000_200f, /* Can't open enclave file. */
+ SGX_ERROR_DEVICE_BUSY = 0x0000_200C, /* Device is busy, mostly EINIT failed. */
+ SGX_ERROR_INVALID_VERSION = 0x0000_200D, /* Metadata version is inconsistent between uRTS and sgx_sign or uRTS is incompatible with current platform. */
+ SGX_ERROR_MODE_INCOMPATIBLE = 0x0000_200E, /* The target enclave 32/64 bit mode or sim/hw mode is incompatible with the mode of current uRTS. */
+ SGX_ERROR_ENCLAVE_FILE_ACCESS = 0x0000_200F, /* Can't open enclave file. */
SGX_ERROR_INVALID_MISC = 0x0000_2010, /* The MiscSelct/MiscMask settings are not correct.*/
SGX_ERROR_INVALID_LAUNCH_TOKEN = 0x0000_2011, /* The launch token is not correct.*/
@@ -73,11 +74,11 @@
SGX_ERROR_UPDATE_NEEDED = 0x0000_4006, /* SGX needs to be updated */
SGX_ERROR_NETWORK_FAILURE = 0x0000_4007, /* Network connecting or proxy setting issue is encountered */
SGX_ERROR_AE_SESSION_INVALID = 0x0000_4008, /* Session is invalid or ended by server */
- SGX_ERROR_BUSY = 0x0000_400a, /* The requested service is temporarily not availabe */
- SGX_ERROR_MC_NOT_FOUND = 0x0000_400c, /* The Monotonic Counter doesn't exist or has been invalided */
- SGX_ERROR_MC_NO_ACCESS_RIGHT = 0x0000_400d, /* Caller doesn't have the access right to specified VMC */
- SGX_ERROR_MC_USED_UP = 0x0000_400e, /* Monotonic counters are used out */
- SGX_ERROR_MC_OVER_QUOTA = 0x0000_400f, /* Monotonic counters exceeds quota limitation */
+ SGX_ERROR_BUSY = 0x0000_400A, /* The requested service is temporarily not availabe */
+ SGX_ERROR_MC_NOT_FOUND = 0x0000_400C, /* The Monotonic Counter doesn't exist or has been invalided */
+ SGX_ERROR_MC_NO_ACCESS_RIGHT = 0x0000_400D, /* Caller doesn't have the access right to specified VMC */
+ SGX_ERROR_MC_USED_UP = 0x0000_400E, /* Monotonic counters are used out */
+ SGX_ERROR_MC_OVER_QUOTA = 0x0000_400F, /* Monotonic counters exceeds quota limitation */
SGX_ERROR_KDF_MISMATCH = 0x0000_4011, /* Key derivation function doesn't match during key exchange */
SGX_ERROR_UNRECOGNIZED_PLATFORM = 0x0000_4012, /* EPID Provisioning failed due to platform not recognized by backend server*/
SGX_ERROR_UNSUPPORTED_CONFIG = 0x0000_4013, /* The config for trigging EPID Provisiong or PSE Provisiong<P is invalid*/
@@ -131,6 +132,7 @@
sgx_status_t::SGX_ERROR_INVALID_STATE => "SGX API is invoked in incorrect order or state.",
sgx_status_t::SGX_ERROR_FEATURE_NOT_SUPPORTED => "Feature is not supported on this platform.",
sgx_status_t::SGX_PTHREAD_EXIT => "Enclave is exited with pthread_exit.",
+ sgx_status_t::SGX_ERROR_MEMORY_MAP_FAILURE => "Failed to reserve memory for the enclave.",
sgx_status_t::SGX_ERROR_INVALID_FUNCTION => "The ecall/ocall index is invalid.",
sgx_status_t::SGX_ERROR_OUT_OF_TCS => "The enclave is out of TCS.",
@@ -223,6 +225,7 @@
sgx_status_t::SGX_ERROR_INVALID_STATE => "SGX_ERROR_INVALID_STATE",
sgx_status_t::SGX_ERROR_FEATURE_NOT_SUPPORTED => "SGX_ERROR_FEATURE_NOT_SUPPORTED",
sgx_status_t::SGX_PTHREAD_EXIT => "SGX_PTHREAD_EXIT",
+ sgx_status_t::SGX_ERROR_MEMORY_MAP_FAILURE => "SGX_ERROR_MEMORY_MAP_FAILURE",
sgx_status_t::SGX_ERROR_INVALID_FUNCTION => "SGX_ERROR_INVALID_FUNCTION",
sgx_status_t::SGX_ERROR_OUT_OF_TCS => "SGX_ERROR_OUT_OF_TCS",
diff --git a/sgx_types/src/function.rs b/sgx_types/src/function.rs
index 7a88787..3e191ba 100755
--- a/sgx_types/src/function.rs
+++ b/sgx_types/src/function.rs
@@ -743,6 +743,8 @@
/* intel DCAP 1.4 */
pub fn sgx_ql_get_root_ca_crl(pp_root_ca_crl: *mut *mut uint8_t, p_root_ca_cal_size: *mut uint16_t) -> sgx_quote3_error_t;
pub fn sgx_ql_free_root_ca_crl(p_root_ca_crl: *const uint8_t) -> sgx_quote3_error_t;
+ /* intel DCAP 2.14 */
+ pub fn sgx_ql_set_logging_callback(logger: sgx_ql_logging_callback_t) -> sgx_quote3_error_t;
}
//#[link(name = "sgx_default_qcnl_wrapper")]
diff --git a/sgx_types/src/metadata.rs b/sgx_types/src/metadata.rs
index b953078..7358359 100644
--- a/sgx_types/src/metadata.rs
+++ b/sgx_types/src/metadata.rs
@@ -157,21 +157,27 @@
impl_packed_struct! {
pub struct layout_entry_t {
- pub id :u16,
- pub attributes :u16,
- pub page_count :u32,
- pub rva :u64,
- pub content_size :u32,
- pub content_offset :u32,
- pub si_flags :si_flags_t,
+ pub id: u16,
+ pub attributes: u16,
+ pub page_count: u32,
+ pub rva: u64,
+ pub content_size: u32,
+ pub content_offset: u32,
+ pub si_flags: si_flags_t,
}
pub struct layout_group_t {
- pub id :u16,
- pub entry_count :u16,
- pub load_times :u32,
- pub load_step :u64,
- pub reserved :[u32; 4],
+ pub id: u16,
+ pub entry_count: u16,
+ pub load_times: u32,
+ pub load_step: u64,
+ pub reserved: [u32; 4],
+ }
+
+ pub struct elrange_config_entry_t {
+ pub enclave_image_address: u64,
+ pub elrange_start_address: u64,
+ pub elrange_size: u64,
}
}
diff --git a/sgx_types/src/types.rs b/sgx_types/src/types.rs
index 1b7d53b..78d218f 100644
--- a/sgx_types/src/types.rs
+++ b/sgx_types/src/types.rs
@@ -1259,6 +1259,18 @@
pub qe_identity_size: uint32_t,
}
+/* intel DCAP 2.14 */
+impl_enum! {
+ #[repr(u32)]
+ #[derive(Copy, Clone, PartialEq, Eq, Debug)]
+ pub enum sgx_ql_log_level_t {
+ SGX_QL_LOG_ERROR = 0,
+ SGX_QL_LOG_INFO = 1,
+ }
+}
+
+pub type sgx_ql_logging_callback_t = extern "C" fn(level: sgx_ql_log_level_t, message: *const c_char);
+
//
// sgx_quote_3.h
//