<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic sgx_ecc256_create_key_pair fail in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecc256-create-key-pair-fail/m-p/1086083#M709</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;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.&lt;/P&gt;

&lt;P&gt;Here is my enclave:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#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(&amp;amp;handle);
	if (status)
	{
		*error = status;
		return 1;
	}
	
	status = sgx_ecc256_create_key_pair(&amp;amp;sk, &amp;amp;pk, &amp;amp;handle);
	if (status)
	{
		*error = status;
		return 2;
	}

	*error = SGX_SUCCESS;
	return 0;

}&lt;/PRE&gt;

&lt;P&gt;and this is my host app:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include "Enc_u.h"
#include "sgx_urts.h"
#include &amp;lt;cstdio&amp;gt;
#include &amp;lt;tchar.h&amp;gt;

#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, &amp;amp;token, &amp;amp;updated, &amp;amp;eid, nullptr);

	if (error)
		printf("Failed to create enclave\n");

	Test(eid, &amp;amp;step, &amp;amp;error);

	if (error)
		printf("Failed on step %d\n", step);

	return 0;
}&lt;/PRE&gt;

&lt;P&gt;The result is error = 1 on step = 2.&lt;/P&gt;

&lt;P&gt;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.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2017 21:59:11 GMT</pubDate>
    <dc:creator>AArya2</dc:creator>
    <dc:date>2017-02-02T21:59:11Z</dc:date>
    <item>
      <title>sgx_ecc256_create_key_pair fail</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecc256-create-key-pair-fail/m-p/1086083#M709</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;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.&lt;/P&gt;

&lt;P&gt;Here is my enclave:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#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(&amp;amp;handle);
	if (status)
	{
		*error = status;
		return 1;
	}
	
	status = sgx_ecc256_create_key_pair(&amp;amp;sk, &amp;amp;pk, &amp;amp;handle);
	if (status)
	{
		*error = status;
		return 2;
	}

	*error = SGX_SUCCESS;
	return 0;

}&lt;/PRE&gt;

&lt;P&gt;and this is my host app:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include "Enc_u.h"
#include "sgx_urts.h"
#include &amp;lt;cstdio&amp;gt;
#include &amp;lt;tchar.h&amp;gt;

#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, &amp;amp;token, &amp;amp;updated, &amp;amp;eid, nullptr);

	if (error)
		printf("Failed to create enclave\n");

	Test(eid, &amp;amp;step, &amp;amp;error);

	if (error)
		printf("Failed on step %d\n", step);

	return 0;
}&lt;/PRE&gt;

&lt;P&gt;The result is error = 1 on step = 2.&lt;/P&gt;

&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 21:59:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecc256-create-key-pair-fail/m-p/1086083#M709</guid>
      <dc:creator>AArya2</dc:creator>
      <dc:date>2017-02-02T21:59:11Z</dc:date>
    </item>
    <item>
      <title>Hi, -Surenthar</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecc256-create-key-pair-fail/m-p/1086084#M710</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;use the below statement instead of this "&lt;SPAN style="color: rgb(0, 0, 0); font-family: Consolas, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 13.008px; background-color: rgb(248, 248, 248);"&gt;status = sgx_ecc256_create_key_pair(&amp;amp;sk, &amp;amp;pk, &amp;amp;handle);"&lt;/SPAN&gt;&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Consolas, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 13.008px; background-color: rgb(248, 248, 248);"&gt;status = sgx_ecc256_create_key_pair(&amp;amp;sk, &amp;amp;pk, handle);&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px;"&gt;-Surenthar&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 07:06:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecc256-create-key-pair-fail/m-p/1086084#M710</guid>
      <dc:creator>Surenthar_S_Intel</dc:creator>
      <dc:date>2017-02-03T07:06:00Z</dc:date>
    </item>
    <item>
      <title>It worked. Thank you!</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecc256-create-key-pair-fail/m-p/1086085#M711</link>
      <description>&lt;P&gt;It worked. Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 14:56:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecc256-create-key-pair-fail/m-p/1086085#M711</guid>
      <dc:creator>AArya2</dc:creator>
      <dc:date>2017-02-03T14:56:51Z</dc:date>
    </item>
    <item>
      <title>hi Arya P,</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecc256-create-key-pair-fail/m-p/1086086#M712</link>
      <description>&lt;P&gt;hi&amp;nbsp;Arya P,&lt;/P&gt;&lt;P&gt;I am very happy that it worked for you.&lt;/P&gt;&lt;P&gt;Could you please,&amp;nbsp;Arya P, share the EDL file of&amp;nbsp; the &lt;STRONG&gt;Test()&amp;nbsp;&lt;/STRONG&gt;function, because I have a problem in thedeclaration of this function in my EDL file.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 09:18:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecc256-create-key-pair-fail/m-p/1086086#M712</guid>
      <dc:creator>larguet__ramzi</dc:creator>
      <dc:date>2019-05-09T09:18:35Z</dc:date>
    </item>
    <item>
      <title>hi,</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecc256-create-key-pair-fail/m-p/1086087#M713</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;How could I get the public key &amp;nbsp;created by the function&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;sgx_ecc256_create_key_pair&lt;/EM&gt;&lt;/STRONG&gt; out&amp;nbsp;of the enclave?&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 12:10:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecc256-create-key-pair-fail/m-p/1086087#M713</guid>
      <dc:creator>larguet__ramzi</dc:creator>
      <dc:date>2019-05-09T12:10:50Z</dc:date>
    </item>
  </channel>
</rss>

