首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >sgx_ecc256_create_key_pair失败

sgx_ecc256_create_key_pair失败
EN

Stack Overflow用户
提问于 2017-02-03 01:12:49
回答 1查看 532关注 0票数 0

我编写了一个非常简单的测试来学习如何在飞地内使用椭圆曲线密码学。但是密钥创建方法在SGX_ERROR_UNEXPECTED中失败。

这是我的飞地:

代码语言:javascript
复制
#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;
}

这是我的主机应用程序:

代码语言:javascript
复制
#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。

这是我在英特尔论坛上的帖子的复制品。如果在这些平台上都能正确地回答这个问题,我将把答案发到另一个平台上,并引用作者的话。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-02-03 07:08:24

使用下面的语句而不是status = sgx_ecc256_create_key_pair(&sk, &pk, &handle);

  • status = sgx_ecc256_create_key_pair(&sk, &pk, handle);
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42015168

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档