2017-02-03 13 views
0

나는 영토 내에서 타원 곡선 암호 작업을 배우는 아주 간단한 테스트를 작성했습니다. 그러나 키 생성 방법은 SGX_ERROR_UNEXPECTED와 함께 실패합니다. 여기 sgx_ecc256_create_key_pair fail

내 영토입니다 :

#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; 
} 

결과는 단계에 오류 = 1 = 2

내가 '무엇을 어떤 아이디어 내가 잘못했거나 잘못 설정 한 것일까 요? 저는 Visual Studio Community 2015와 Intel C++ Compiler 17.0을 사용하고 있습니다.

추신 : my post on an Intel forum의 복제본입니다. 이 플랫폼들 각각에 대해 적절히 대답한다면, 나는 그 대답을 다른 저자에게 게시 할 것이고, 또한 저자를 인용 할 것이다.

+0

status = sgx_ecc256_create_key_pair(&sk, &pk, &handle); 당신은 EDL 문이 EDL은 중요하지 않습니다 –

+0

공유 할 수 있습니다. 문제는 자체 대신에 EC 컨텍스트 변수에 포인터를 전달했기 때문입니다. 다른 이유가 필요하면 알려주세요. –

+0

자습서로 사용해야합니다. 정말 유용 할 것입니다. [email protected] –

답변

2

를 사용하여 문 아래 대신

  • status = sgx_ecc256_create_key_pair(&sk, &pk, handle);