<?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 John, in Intel Confidential Computing</title>
    <link>https://community.intel.com/t5/Intel-Confidential-Computing/File-system-sample-code-reading-data/m-p/1130656#M1886</link>
    <description>&lt;P&gt;John,&lt;/P&gt;

&lt;P&gt;I just compiled and ran the provided example without modification and the output is correct as follows:&lt;/P&gt;

&lt;P&gt;Enclave Secret Value: Hello Enclave!&lt;BR /&gt;
	Size of Write= &amp;nbsp;14&lt;BR /&gt;
	Size of Read= 14&lt;BR /&gt;
	Read Data= Hello Enclave!&lt;/P&gt;

&lt;P&gt;From what you posted, the size value is not the issue.&lt;/P&gt;

&lt;P&gt;Output:&lt;BR /&gt;
	"Size of Read= 14&lt;BR /&gt;
	&amp;nbsp;Read Data= Hello E"&lt;/P&gt;

&lt;P&gt;Size of 14 is correct. and "Hello E" string has only the length of 7.&lt;/P&gt;

&lt;P&gt;Given that the code shows putting a NULL character at the end of the buffer at 14&lt;/P&gt;

&lt;DIV&gt;ret = ecall_file_read(eid, &amp;amp;sizeOfRead, fp, data);&lt;/DIV&gt;

&lt;DIV&gt;printf("Size of Read= %d\n", sizeOfRead);&lt;/DIV&gt;

&lt;DIV&gt;data[sizeOfRead] = '\0';&lt;/DIV&gt;

&lt;DIV&gt;printf("Read Data= %s\n", data);&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;it should be printing out at least 14 characters unless your data has a NULL character in the middle of that string.&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;Would you please download and run the provided example as is one more time and let us know the result?&lt;/DIV&gt;

&lt;DIV&gt;Thanks,&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Sep 2017 15:23:41 GMT</pubDate>
    <dc:creator>Hoang_N_Intel</dc:creator>
    <dc:date>2017-09-26T15:23:41Z</dc:date>
    <item>
      <title>File system sample code - reading data</title>
      <link>https://community.intel.com/t5/Intel-Confidential-Computing/File-system-sample-code-reading-data/m-p/1130655#M1885</link>
      <description>&lt;P&gt;Hi there,&lt;BR /&gt;
	&lt;SPAN style="font-size: 1em;"&gt;I am following the sample code from the file system guide (https://software.intel.com/en-us/articles/overview-of-intel-protected-file-system-library-using-software-guard-extensions). &amp;nbsp;&lt;/SPAN&gt;The&lt;SPAN style="font-size: 1em;"&gt;&amp;nbsp;&lt;/SPAN&gt;edl sets the readData buffer as "[in, out, string]":&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;public size_t ecall_file_read([user_check]SGX_FILE* fp,[in,out,string]char* readData);&lt;/PRE&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Unfortunately, the app code below only returns part of the data:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;//Read from File
size_t sizeOfRead = 0;
char data[100];
ret = ecall_file_read(eid, &amp;amp;sizeOfRead, fp, data);
printf("Size of Read= %d\n", sizeOfRead);
data[sizeOfRead] = '\0';
printf("Read Data= %s\n", data);
&lt;/PRE&gt;

&lt;P&gt;Output:&lt;BR /&gt;
	"Size of Read= 14&lt;BR /&gt;
	&amp;nbsp;Read Data= Hello E"&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;The data is indeed read in the enclave but only part of it is returned to the app. If I modify the&amp;nbsp;&lt;/SPAN&gt;edl to "[out, size=len]" I need to pass the size but at least I get all data over to the app consistenly.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Output: "Read Data= Hello Enclave!"&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Any ideas what might be wrong with the sample code or my setup, is it possible to avoid specifying the size upfront and still make this work?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 23:32:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Confidential-Computing/File-system-sample-code-reading-data/m-p/1130655#M1885</guid>
      <dc:creator>John_D_4</dc:creator>
      <dc:date>2017-09-25T23:32:35Z</dc:date>
    </item>
    <item>
      <title>John,</title>
      <link>https://community.intel.com/t5/Intel-Confidential-Computing/File-system-sample-code-reading-data/m-p/1130656#M1886</link>
      <description>&lt;P&gt;John,&lt;/P&gt;

&lt;P&gt;I just compiled and ran the provided example without modification and the output is correct as follows:&lt;/P&gt;

&lt;P&gt;Enclave Secret Value: Hello Enclave!&lt;BR /&gt;
	Size of Write= &amp;nbsp;14&lt;BR /&gt;
	Size of Read= 14&lt;BR /&gt;
	Read Data= Hello Enclave!&lt;/P&gt;

&lt;P&gt;From what you posted, the size value is not the issue.&lt;/P&gt;

&lt;P&gt;Output:&lt;BR /&gt;
	"Size of Read= 14&lt;BR /&gt;
	&amp;nbsp;Read Data= Hello E"&lt;/P&gt;

&lt;P&gt;Size of 14 is correct. and "Hello E" string has only the length of 7.&lt;/P&gt;

&lt;P&gt;Given that the code shows putting a NULL character at the end of the buffer at 14&lt;/P&gt;

&lt;DIV&gt;ret = ecall_file_read(eid, &amp;amp;sizeOfRead, fp, data);&lt;/DIV&gt;

&lt;DIV&gt;printf("Size of Read= %d\n", sizeOfRead);&lt;/DIV&gt;

&lt;DIV&gt;data[sizeOfRead] = '\0';&lt;/DIV&gt;

&lt;DIV&gt;printf("Read Data= %s\n", data);&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;it should be printing out at least 14 characters unless your data has a NULL character in the middle of that string.&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV&gt;Would you please download and run the provided example as is one more time and let us know the result?&lt;/DIV&gt;

&lt;DIV&gt;Thanks,&lt;/DIV&gt;

&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 15:23:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Confidential-Computing/File-system-sample-code-reading-data/m-p/1130656#M1886</guid>
      <dc:creator>Hoang_N_Intel</dc:creator>
      <dc:date>2017-09-26T15:23:41Z</dc:date>
    </item>
  </channel>
</rss>

