- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I've written a very simple test to learn working with elliptic curve cryptography inside an enclave. But the key creation method fails with SGX_ERROR_UNEXPECTED.
Here is my enclave:
#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;
}
and this is my host app:
#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;
}
The result is error = 1 on step = 2.
Any ideas what I'm doing wrong or what I might have configured incorrectly? I'm using Visual Studio Community 2015 and Intel C++ Compiler 17.0.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
use the below statement instead of this "status = sgx_ecc256_create_key_pair(&sk, &pk, &handle);"
- status = sgx_ecc256_create_key_pair(&sk, &pk, handle);
-Surenthar
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
use the below statement instead of this "status = sgx_ecc256_create_key_pair(&sk, &pk, &handle);"
- status = sgx_ecc256_create_key_pair(&sk, &pk, handle);
-Surenthar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It worked. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi Arya P,
I am very happy that it worked for you.
Could you please, Arya P, share the EDL file of the Test() function, because I have a problem in thedeclaration of this function in my EDL file.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
How could I get the public key created by the function sgx_ecc256_create_key_pair out of the enclave?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page