0

I'm very new to SGX and wanted to start with something simple. Fortunately, I found this very basic tutorial. Unfortunately, as simple as it is, I can't get it to work. The code executes, but there are errors in the output.

[sgx_create_enclavew ..\urts\win\urts.cpp:195] Couldn't open file with CreateFile() 

error 0x200f, failed to create enclave.

Buffertests:
Buffer before change: Hello World!
Buffer after change: Hello World!

Stringtests:
Returned Secret:
Saved Secret: My secret string
Load Secret:

Integertests:
secretIntValue first load: 0
saved a 1337 to the enclave.
secretIntValue second load after 1337 was saved: 0

error, failed to destroy enclave.

image of output

the tutorial says:

If you get the error SGX couldn't find the enclave file. The solution is to move the enclave_test_save.signed.dll into the same folder where the app_test_save.exe is located.

which I've tried, but it didn't solve the problem.

when I try to create the enclave using:

    sgx_create_enclave(ENCLAVE_FILE, SGX_DEBUG_FLAG, &token, &updated, &eid, NULL);

it returns: SGX_ERROR_ENCLAVE_FILE_ACCESS

could the problem be a result of using a different version of Visual Studio? (The tutorial uses VS 2012, while I'm using VS 2015)

Ziz
  • 1
  • 2

3 Answers3

1

Did you run the application through command prompt or from IDE? If you are using IDE, You need to change the debugging properties to $(OutDir) from $(ProjecttDir) under Project Properties->Configuration Properties->Debugging->Working Directory.(Both Enclave and Application) Select the Intel(R) SGX Debugger.

Surenthar
  • 361
  • 2
  • 5
0

Disclaimer: I had the same error although under a different setting (Ubuntu, eclipse) so I am not sure to what extent this will help.

Before initialize_enclave() is called (which in turn calls sgx_create_enclave()), a chdir(absolutePath) command needs to be executed, where absolutePath needs to be the absolute path to where your executable is.

My error was due to a wrong path I used.

savx2
  • 1,011
  • 2
  • 10
  • 28
0

Thanks, I solved it. turns out I had to place enclave_test_save.signed.dll in the root folder with the .edl file and not with the .exe file.

Ziz
  • 1
  • 2