0

我对新交所很陌生,想从简单的事情开始。幸运的是,我找到了这个非常基础的教程。不幸的是,尽管它很简单,但我无法让它工作。代码执行,但输出中有错误。

[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 文件。解决方案是将 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)

4

3 回答 3

1

您是通过命令提示符还是从 IDE 运行应用程序?如果您使用的是 IDE,您需要在 Project Properties->Configuration Properties->Debugging->Working Directory 下将调试属性从 $(ProjecttDir) 更改为 $(OutDir)。(Enclave 和 Application)选择 Intel(R)新交所调试器

于 2017-01-24T09:12:15.087 回答
0

免责声明:尽管在不同的设置(Ubuntu,eclipse)下,我遇到了同样的错误,所以我不确定这会在多大程度上有所帮助。

initialize_enclave()调用之前(依次调用sgx_create_enclave()),chdir(absolutePath)需要执行一个命令,其中absolutePath需要是可执行文件所在位置的绝对路径。

我的错误是由于我使用了错误的路径。

于 2017-01-19T19:22:18.927 回答
0

谢谢,我解决了。事实证明,我必须将 enclave_test_save.signed.dll 与 .edl 文件一起放置在根文件夹中,而不是与 .exe 文件一起放置。

于 2017-01-23T10:08:44.163 回答