- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
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). The edl sets the readData buffer as "[in, out, string]":
public size_t ecall_file_read([user_check]SGX_FILE* fp,[in,out,string]char* readData);
Unfortunately, the app code below only returns part of the data:
//Read from File size_t sizeOfRead = 0; char data[100]; ret = ecall_file_read(eid, &sizeOfRead, fp, data); printf("Size of Read= %d\n", sizeOfRead); data[sizeOfRead] = '\0'; printf("Read Data= %s\n", data);
Output:
"Size of Read= 14
Read Data= Hello E"
The data is indeed read in the enclave but only part of it is returned to the app. If I modify the edl to "[out, size=len]" I need to pass the size but at least I get all data over to the app consistenly.
Output: "Read Data= Hello Enclave!"
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?
Thanks!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
John,
I just compiled and ran the provided example without modification and the output is correct as follows:
Enclave Secret Value: Hello Enclave!
Size of Write= 14
Size of Read= 14
Read Data= Hello Enclave!
From what you posted, the size value is not the issue.
Output:
"Size of Read= 14
Read Data= Hello E"
Size of 14 is correct. and "Hello E" string has only the length of 7.
Given that the code shows putting a NULL character at the end of the buffer at 14
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page