Intel® Software Guard Extensions (Intel® SGX)
Discussion board focused on hardware-based isolation and memory encryption to provide extended code protection in solutions.

how to use simulation mode?

quizy_j_
Beginner
3,952 Views

The Intel SGX SDK for Windows mentions that there is a simulation mode in page 65

"The simulation mode works in the same way as the debug mode except the fact that true hardware is not exercised, instead the Intel® SGX instructions are simulated in software."

But I cannot find any details in how to use this mode, only that in Project Settings section (p25,26), it mentions the dependencies are different. I used the simulation libraries instead of the original ones as it suggested and generated the example enclave and application ("hello world"). However, when I tried to run the application on my computer without SGX hardware, it says:

[sgx_create_enclavew ..\..\..\psw\urts\win\urts.cpp:83] Couldn't open file with
CreateFile()
App: error 0x200f, failed to create enclave.

And the error means 

0x200F SGX_ERROR_ENCLAVE_FILE_ACCESS Can’t open enclave file

So what might be the problem? As I've already configure the projects to use the simulation libraries, it should run ok without SGX hardware.

0 Kudos
1 Solution
Surenthar_S_Intel
3,952 Views

Hi Quizy,

I have checked your source code, you didn't change the "current working directory" pointing to $(OutDir) instead of $(ProjectDir) in simulation mode (Both Application and Enclave).

Please find the modified source code of yours from below link 

https://drive.google.com/open?id=0B4N3YNdBPBe8RW03UVBCZnN2VUE ;

Thanks

Surenthar Selvaraj

View solution in original post

0 Kudos
11 Replies
Surenthar_S_Intel
3,952 Views

Hi Quizy,

Did you run the application through command prompt or Local SGX Debugger?
If you are using the Local SGX Debugger, Please make sure change the "current working directory" pointing to $(OutDir) instead of $(ProjectDir).

Configuration Properties --> Debugging --> Working Directory --> $(OutDir).

Thanks.

0 Kudos
quizy_j_
Beginner
3,952 Views

I've already set the working directory to $(OutDir), but the error still exists. I write the enclave and the application according to the SGX SDK, the dll (enclave) file and exe (application) file both generated successfully, but it cannot run. This is my "hello world" source code, It would be nice if you can check it for me.

https://drive.google.com/open?id=0Bw1j4eporbRMZkh3WHFTOXpGNG8

0 Kudos
Surenthar_S_Intel
3,953 Views

Hi Quizy,

I have checked your source code, you didn't change the "current working directory" pointing to $(OutDir) instead of $(ProjectDir) in simulation mode (Both Application and Enclave).

Please find the modified source code of yours from below link 

https://drive.google.com/open?id=0B4N3YNdBPBe8RW03UVBCZnN2VUE ;

Thanks

Surenthar Selvaraj

0 Kudos
quizy_j_
Beginner
3,952 Views

Thanks Surenthar,

I make the mistake to use the debug configuration to run the simulation enclave, and chosen the wrong project to run. It should be the app instead of the enclave.

Best wishes

Quizy

0 Kudos
Clindo_Devassy_K_
3,952 Views

Hi,

Will the simulation mode work on processors older than 6th gen?  Or is there any way to simulate the SGX in 5th generation processor?

Regards,

Clindo

0 Kudos
Surenthar_S_Intel
3,952 Views

Hi,

Simulation mode works processors older than 6th gen. Please read my blogs from below link 

https://software.intel.com/en-us/blogs/2016/05/30/usage-of-simulation-mode-in-sgx-enhanced-application

-Surenthar

0 Kudos
Clindo_Devassy_K_
3,952 Views

Hi Surenthar,

I followed the blog and downloaded the sdk from https://software.intel.com/en-us/sgx-sdk. But I could not install it in i7- 5th Gen, it is exiting with error: ' The platform is not SGX-compatible. Please check your SGX BIOS settings. Install will cancel'.

How could I do the simulation if sdk is not getting installed? Please help.

Thanks and regards,

Clindo

0 Kudos
Francisco_C_Intel
3,952 Views

It looks like you are trying to install the Platform SW, not the SDK. The SDK can build and run samples in simulation mode. The PSW requires an SGX-compatible system.

0 Kudos
Clindo_Devassy_K_
3,952 Views

 Ok, Let me try it.

0 Kudos
Araldo__Andrea
Beginner
3,952 Views

Clindo, have you tried?

Could you please share your experience?

0 Kudos
qinghao__wang
Beginner
3,952 Views

Hi ,

In the example code of SGX simulation mode,

I have changed the value of "secret" in "Enclave_Simulation.cpp",but the result of the program is always "Hello Encalve!" . Why?

Please help. Thank you for your kind!

0 Kudos
Reply