File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
intel-sgx/sgxs-loaders/src/sgx_enclave_common Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ pub const LIBRARY: &str = "libsgx_enclave_common.so.1";
5656#[ cfg( windows) ]
5757pub const LIBRARY : & str = "sgx_enclave_common.dll" ;
5858
59+ #[ repr( align( 4096 ) ) ]
60+ pub struct Align4096 < T > ( pub T ) ;
61+
5962pub const SYM_ENCLAVE_CREATE : & [ u8 ] = b"enclave_create\0 " ;
6063pub type EnclaveCreateFn = unsafe extern "C" fn (
6164 base_address : * mut c_void ,
@@ -71,7 +74,7 @@ pub const SYM_ENCLAVE_LOAD_DATA: &[u8] = b"enclave_load_data\0";
7174pub type EnclaveLoadDataFn = unsafe extern "C" fn (
7275 target_address : * mut c_void ,
7376 target_size : usize ,
74- source_buffer : * const u8 ,
77+ source_buffer : * const Align4096 < [ u8 ; 4096 ] > ,
7578 data_properties : PageProperties ,
7679 enclave_error : Option < & mut u32 > ,
7780) -> usize ;
Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ impl EnclaveLoad for InnerLibrary {
173173 page : ( MeasEAdd , PageChunks , [ u8 ; 4096 ] ) ,
174174 ) -> Result < ( ) , Self :: Error > {
175175 let ( eadd, chunks, data) = page;
176+ let data = Align4096 ( data) ;
176177
177178 let mut flags = PageProperties :: empty ( ) ;
178179 if eadd
@@ -207,7 +208,7 @@ impl EnclaveLoad for InnerLibrary {
207208 if ( mapping. device . enclave_load_data ) (
208209 ( mapping. base + eadd. offset ) as _ ,
209210 0x1000 ,
210- data. as_ptr ( ) ,
211+ & data,
211212 flags,
212213 Some ( & mut error) ,
213214 ) != 0x1000
You can’t perform that action at this time.
0 commit comments