I am following the sample code from the file system guide (https://software.intel.com/en-us/articles/overview-of-intel-protected-fi...). 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; ret = ecall_file_read(eid, &sizeOfRead, fp, data); printf("Size of Read= %d\n", sizeOfRead); data[sizeOfRead] = '\0'; printf("Read Data= %s\n", data);
"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?