我编写了一个非常简单的测试来学习如何在飞地内使用椭圆曲线密码学。但是密钥创建方法在SGX_ERROR_UNEXPECTED中失败。
这是我的飞地:
#include "Enc_t.h"
#include "sgx_trts.h"
#include "sgx_tcrypto.h"
int Test(sgx_status_t *error)
{
sgx_ecc_state_handle_t handle;
sgx_ec256_private_t sk;
sgx_ec256_public_t pk;
sgx_status_t status;
status = sgx_ecc256_open_context(&handle);
if (status)
{
*error = status;
return 1;
}
status = sgx_ecc256_create_key_pair(&sk, &pk, &handle);
if (status)
{
*error = status;
return 2;
}
*error = SGX_SUCCESS;
return 0;
}这是我的主机应用程序:
#include "Enc_u.h"
#include "sgx_urts.h"
#include <cstdio>
#include <tchar.h>
#define ENC _T("../Debug/Enc.signed.dll")
int main()
{
sgx_status_t error;
sgx_enclave_id_t eid;
sgx_launch_token_t token;
int updated = 0;
int step;
error = sgx_create_enclave(ENC, SGX_DEBUG_FLAG, &token, &updated, &eid, nullptr);
if (error)
printf("Failed to create enclave\n");
Test(eid, &step, &error);
if (error)
printf("Failed on step %d\n", step);
return 0;
}结果是步骤= 2上的错误=1。
你知道我做错了什么或者我可能配置错了什么吗?我正在使用VisualStudioCommunity2015和Intel C++编译器17.0。
这是我在英特尔论坛上的帖子的复制品。如果在这些平台上都能正确地回答这个问题,我将把答案发到另一个平台上,并引用作者的话。
发布于 2017-02-03 07:08:24
使用下面的语句而不是status = sgx_ecc256_create_key_pair(&sk, &pk, &handle);
status = sgx_ecc256_create_key_pair(&sk, &pk, handle);https://stackoverflow.com/questions/42015168
复制相似问题