<?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 I assume that get_secret that in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126974#M1799</link>
    <description>&lt;P&gt;I assume that get_secret that you have here is an ECALL. You will need to provide the OCALL to return the secret back.&lt;/P&gt;

&lt;P&gt;Is it possible that you can zip and post&amp;nbsp;your complete project here?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Hoang&lt;/P&gt;</description>
    <pubDate>Wed, 20 Sep 2017 17:22:33 GMT</pubDate>
    <dc:creator>Hoang_N_Intel</dc:creator>
    <dc:date>2017-09-20T17:22:33Z</dc:date>
    <item>
      <title>sgx_ecall works to store data in enclave, now how do I retrieve it?</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126971#M1796</link>
      <description>&lt;P&gt;I'm using the 'SGX First App', bundled with the SDK. It calls sgx_ecall to store data into the enclave. This is working for me.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Q: Now, how do I get the data out of the enclave?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 12:17:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126971#M1796</guid>
      <dc:creator>OvalPiston</dc:creator>
      <dc:date>2017-09-18T12:17:43Z</dc:date>
    </item>
    <item>
      <title>Getting the secret out of the</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126972#M1797</link>
      <description>&lt;P&gt;Getting the secret out of the enclave is very similar to printing the hash from the enclave in that example. You need to provide an OCALL to receive the secret from the application and an ECALL into the enclave to get the secret.&lt;/P&gt;

&lt;P&gt;Here is an updated EDL file for that example:&lt;/P&gt;

&lt;DIV&gt;enclave {&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp; &amp;nbsp; trusted {&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void store_secret([in, string] char *msg);&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public int print_hash([out] sgx_status_t *error); &amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void get_secret();&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp; &amp;nbsp; };&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp; &amp;nbsp; untrusted {&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; void o_print_hash([in] unsigned char hash[32]); &amp;nbsp; &amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; void ocall_print_secret([in, string] const char *str);&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp; &amp;nbsp; };&lt;/DIV&gt;

&lt;DIV&gt;};&lt;/DIV&gt;

&lt;DIV&gt;Here is a simple implementation to illustrate that concept:&lt;/DIV&gt;

&lt;DIV&gt;
	&lt;DIV&gt;In the enclave:&lt;/DIV&gt;

	&lt;DIV&gt;char secret[MAX_MSG_LEN];&lt;/DIV&gt;

	&lt;DIV&gt;...&lt;/DIV&gt;

	&lt;DIV&gt;
		&lt;DIV&gt;void get_secret()&lt;/DIV&gt;

		&lt;DIV&gt;{&lt;/DIV&gt;

		&lt;DIV&gt;&amp;nbsp; &amp;nbsp;ocall_print_secret(secret);&lt;/DIV&gt;

		&lt;DIV&gt;}&lt;/DIV&gt;

		&lt;DIV&gt;and in the app:&lt;/DIV&gt;

		&lt;DIV&gt;void ocall_print_secret(const char *str)&lt;/DIV&gt;

		&lt;DIV&gt;{&lt;/DIV&gt;

		&lt;DIV&gt;&amp;nbsp; &amp;nbsp;printf("%s", str);&lt;/DIV&gt;

		&lt;DIV&gt;}&lt;/DIV&gt;

		&lt;DIV&gt;Please note that this code is for demonstration purpose only.&lt;/DIV&gt;

		&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
	&lt;/DIV&gt;

	&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 18 Sep 2017 16:48:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126972#M1797</guid>
      <dc:creator>Hoang_N_Intel</dc:creator>
      <dc:date>2017-09-18T16:48:01Z</dc:date>
    </item>
    <item>
      <title>That doens't show the secret.</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126973#M1798</link>
      <description>&lt;P&gt;That doens't show the secret. It all compiles, but calling it doesn't show the secret.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;The 'Enclave_u.c' file already has a function:&amp;nbsp;sgx_status_t get_secret(sgx_enclave_id_t eid, char* out)&lt;/P&gt;

&lt;P&gt;Since the above code won't work, could this be used?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 12:28:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126973#M1798</guid>
      <dc:creator>OvalPiston</dc:creator>
      <dc:date>2017-09-20T12:28:26Z</dc:date>
    </item>
    <item>
      <title>I assume that get_secret that</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126974#M1799</link>
      <description>&lt;P&gt;I assume that get_secret that you have here is an ECALL. You will need to provide the OCALL to return the secret back.&lt;/P&gt;

&lt;P&gt;Is it possible that you can zip and post&amp;nbsp;your complete project here?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Hoang&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 17:22:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126974#M1799</guid>
      <dc:creator>Hoang_N_Intel</dc:creator>
      <dc:date>2017-09-20T17:22:33Z</dc:date>
    </item>
    <item>
      <title>Here is enclave.cpp:</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126975#M1800</link>
      <description>&lt;P&gt;I took the &lt;SPAN style="font-size: 13.008px;"&gt;code is from the SGX First App sample code, then added only your comments above.&amp;nbsp;&lt;/SPAN&gt;See attached ZIP file containing two .cpp files and .edl file.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 17:46:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126975#M1800</guid>
      <dc:creator>OvalPiston</dc:creator>
      <dc:date>2017-09-20T17:46:00Z</dc:date>
    </item>
    <item>
      <title>There is an error in the main</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126976#M1801</link>
      <description>&lt;P&gt;There is an error in the main app. The ECALL is used to call into the Enclave and the OCALL is used to call from the Enclave back to the app. You just need to simply replace the OCALL in your main app (&amp;nbsp;ocall_print_secret(out); ) by the ECALL function of get_secret( eid ) ;&lt;/P&gt;

&lt;P&gt;The&amp;nbsp;code fragment in your main should be like this:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;...&lt;/P&gt;

&lt;P&gt;if (status != SGX_SUCCESS) {fprintf(stderr, "ECALL: store_secret: 0x%08x\n", status);Exit(1);}&lt;/P&gt;

&lt;P&gt;get_secret(eid);&lt;/P&gt;

&lt;P&gt;status = print_hash(eid, &amp;amp;rv, &amp;amp;enclave_error);&lt;/P&gt;

&lt;P&gt;Please give it a try and let us know.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Hoang&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 18:03:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126976#M1801</guid>
      <dc:creator>Hoang_N_Intel</dc:creator>
      <dc:date>2017-09-20T18:03:01Z</dc:date>
    </item>
    <item>
      <title>Ok, I understand ecalls and</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126977#M1802</link>
      <description>&lt;P&gt;Ok, I understand ecalls and ocalls, and get_secret(eid) as above ran successfully, but still doesn't return value stored in secret[MAX_MSG_LEN] in the enclave.cpp.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;I'm confused. H&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;ow do we get chars to return to the calling function in SGX First App? Or any string back to the calling app, for that matter, from the enclave code?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;And does 'Enclave_u.c' get built each time a recompile is done? Do we need to modify that file too?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 18:41:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126977#M1802</guid>
      <dc:creator>OvalPiston</dc:creator>
      <dc:date>2017-09-20T18:41:00Z</dc:date>
    </item>
    <item>
      <title>First of all, I ran the</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126978#M1803</link>
      <description>&lt;P&gt;First of all, I ran the example with the code that you provided and it displays the secret string of "password"&lt;/P&gt;

&lt;P&gt;Here is the output that I see:&lt;/P&gt;

&lt;P&gt;password&lt;BR /&gt;
	SHA-256 hash of your secret (including the newline) is:&lt;BR /&gt;
	5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8&lt;/P&gt;

&lt;P&gt;Verify this hash by entering your secret in an online SHA256&lt;BR /&gt;
	calculator such as:&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &lt;A href="http://passwordsgenerator.net/sha256-hash-generator/"&gt;http://passwordsgenerator.net/sha256-hash-generator/&lt;/A&gt;&lt;BR /&gt;
	&amp;nbsp; &lt;A href="http://www.xorbin.com/tools/sha256-hash-calculator"&gt;http://www.xorbin.com/tools/sha256-hash-calculator&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;(Don't forget to include the trailing newline!)&lt;BR /&gt;
	Press ENTER to exit...&lt;/P&gt;

&lt;P&gt;Please update your OCALL to this and let me know whether you can see it or not&lt;/P&gt;

&lt;P&gt;void ocall_print_secret(const char *str)&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;printf("DEBUG: %s", str);&lt;BR /&gt;
	}&lt;/P&gt;

&lt;P&gt;Here are the answers to your questions:&lt;/P&gt;

&lt;P&gt;How do we get chars to return to the calling function in SGX First App? Or any string back to the calling app, for that matter, from the enclave code?&lt;/P&gt;

&lt;P&gt;These are&amp;nbsp;just standard C parameters that you can have as many as you need in your function.&lt;/P&gt;

&lt;P&gt;And does 'Enclave_u.c' get built each time a recompile is done? Do we need to modify that file too?&lt;/P&gt;

&lt;P&gt;Anything that is under "Generated files" folder in Visual Studio is automatically regenerated&lt;BR /&gt;
	and you should not modify them.&lt;BR /&gt;
	For example, Enclave_u.h and Enclave_u.cpp in the untrusted app&lt;BR /&gt;
	and Enclave_t.h and Enclave_t.cpp in the trusted Enclave should not be modified.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 21:11:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126978#M1803</guid>
      <dc:creator>Hoang_N_Intel</dc:creator>
      <dc:date>2017-09-20T21:11:51Z</dc:date>
    </item>
    <item>
      <title>Attached is the output. There</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126979#M1804</link>
      <description>&lt;P&gt;Attached is the output. There is no showing of the secret string "password".&lt;/P&gt;

&lt;P&gt;You must have different source than I have.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 21:42:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126979#M1804</guid>
      <dc:creator>OvalPiston</dc:creator>
      <dc:date>2017-09-20T21:42:00Z</dc:date>
    </item>
    <item>
      <title>Can you zip and upload the</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126980#M1805</link>
      <description>&lt;P&gt;Can you zip and upload the entire solution? I'd like to run it as is and&amp;nbsp;look at your project settings as well. Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 21:53:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126980#M1805</guid>
      <dc:creator>Hoang_N_Intel</dc:creator>
      <dc:date>2017-09-20T21:53:11Z</dc:date>
    </item>
    <item>
      <title>This issue has been resolved.</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126981#M1806</link>
      <description>&lt;P&gt;This issue has been resolved. The untrusted app just needs to make the ECALL as I indicated in previous posting.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 00:05:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/sgx-ecall-works-to-store-data-in-enclave-now-how-do-I-retrieve/m-p/1126981#M1806</guid>
      <dc:creator>Hoang_N_Intel</dc:creator>
      <dc:date>2017-09-21T00:05:30Z</dc:date>
    </item>
  </channel>
</rss>

