我对SGX很新,并希望从简单的事情开始。幸运的是,我找到了this very basic tutorial。不幸的是,虽然很简单,但我无法让它发挥作用。代码执行,但输出中存在错误。
[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.
教程说:
如果您收到错误,SGX无法找到安全区文件。解决方案是将enclave_test_save.signed.dll移动到app_test_save.exe所在的同一文件夹中。
我已尝试过,但它没有解决问题。
当我尝试使用以下方法创建飞地时:
sgx_create_enclave(ENCLAVE_FILE, SGX_DEBUG_FLAG, &token, &updated, &eid, NULL);
它返回:SGX_ERROR_ENCLAVE_FILE_ACCESS
问题可能是因为使用不同版本的Visual Studio? (本教程使用VS 2012,而我使用VS 2015)
答案 0 :(得分:1)
您是通过命令提示符还是从IDE运行应用程序? 如果您使用的是IDE,则需要在项目属性 - >配置属性 - >调试 - >工作目录下将$(Outtir)从$(ProjecttDir)更改为 $(OutDir)。(Enclave和Application)选择英特尔(R)SGX调试器。
答案 1 :(得分:0)
免责声明:虽然在不同的设置(Ubuntu,eclipse)下我有同样的错误,所以我不确定这会有多大帮助。
在调用initialize_enclave()
之前(后者调用sgx_create_enclave()
),需要执行chdir(absolutePath)
命令,其中absolutePath
需要是绝对路径可执行文件是。
我的错误是由于我使用了错误的路径。
答案 2 :(得分:0)
谢谢,我解决了。事实证明我必须将enclave_test_save.signed.dll放在带有.edl文件的根文件夹中,而不是放在.exe文件中。