c++ - 无法在硬件模式下创建 SGX 飞地 - "invalid launch token",即使文档将无效的启动 token 指定为第一个

标签 c++ intel sgx

英特尔的文档说 here如果没有先前的启动 token ,则应使用全为零的“无效” token 。这在模拟模式下完美运行,但在硬件模式下它返回 SGX_ERROR_INVALID_LAUNCH_TOKEN,即使这正是它所要求的。

    // Initialize an "invalid" first token, as the documentation specifies (all zeros)
    sgx_launch_token_t token = {0};

    // Create enclave
    sgx_enclave_id_t id;
    int updated = 0;
    const auto status = sgx_create_enclave("enclave.signed.so", SGX_DEBUG_FLAG, &token, &updated, &id, NULL);

    if (status != SGX_SUCCESS) {
        throw "Failed to initialize enclave. (" + get_error_message(status) + ")";
    }

代码返回 status = SGX_ERROR_INVALID_LAUNCH_TOKEN

Failed to initialize enclave. (The launch token is not correct.)

我在构建过程中可能遗漏了什么吗?

最佳答案

问题是由于我的应用程序使用了 /usr/lib 中的 libsgx_urts.so 和我的安装路径中的 libsgx_uae_service.so SGX SDK(在我的例子中是 /opt/intel/sgxsdk/lib64。)

我将链接更改为以下内容:

模拟模式: libsgx_urts.so =>/opt/intel/sgxsdk/lib64/libsgx_urts.so libsgx_uae_service.so =>/opt/intel/sgxsdk/lib64/libsgx_uae_service.so

硬件模式: libsgx_urts.so =>/usr/lib/libsgx_urts.so libsgx_uae_service.so =>/usr/lib/libsgx_uae_service.so `

关于c++ - 无法在硬件模式下创建 SGX 飞地 - "invalid launch token",即使文档将无效的启动 token 指定为第一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49299603/

相关文章:

linux - LIDT的操作数是位移/绝对地址

c++ - 某些阵列大小的性能下降

intel - Intel SGX 是否在模拟模式下提供软件内存保护?

c++ - 设置数组元素时发生 MSVC 访问冲突

c++ - 许多情况下的开关优化保证任何情况下均等的访问时间? ( C++ )

c++ - 事务中的线程信号

c++ - 将 2D vector 转换为 C 类型的最佳方法(对于 SGX enclave)

c++ - 加载 enclave : Couldn't open file with CreateFile() 时出错

c++ - 正确使用 Windows 控制台 API 的 CHAR_INFO 结构

c++ - 如何散列 QVariant?