SGX Local Attestation 样本在模拟器中返回 0x3002

SGX Local Attestation sample returning 0x3002 in simulator

我一辈子都无法按照说明成功地在全新 Linux 安装中将 LocalAttestation 示例正确地 运行。鉴于这是在模拟模式下构建的,我还以为没有额外的依赖项?

我修改了演示以提供额外的输出,这一行 returns 3002 SGX_ERROR_INVALID_ATTRIBUTE:

printf("creating enclave 1\n");
    ret = sgx_create_enclave(ENCLAVE1_PATH, SGX_DEBUG_FLAG, &launch_token, &launch_token_updated, &e1_enclave_id, NULL);
    if (ret != SGX_SUCCESS) {
        printf("Failed. Return value is: %X\n", ret);
                return ret;
    }

这是示例,直接来自 linux SDK:https://github.com/intel/linux-sgx and this error isn't even mentioned as a possibility in Intel's documentation on the function: https://software.intel.com/en-us/sgx-sdk-dev-reference-sgx-create-enclave

如有任何帮助,我们将不胜感激!

-- 亨利

原来这是示例代码的问题。通过初始化 launch_token 清零,一切都按预期工作:

sgx_launch_token_t launch_token = {0};
ret =sgx_create_enclave(_T(ENCLAVE_PATH),1,&launch_token,&launch_token_update,&enclave_id, NULL);
            if(ret !=SGX_SUCCESS)
            {
                printf("Failed to create enclave");
            }
            printf("Successfully create enclave.");
            printf("\nEnclaveID %llx", enclave_id);