使用OCALL,我想獲得一個在非信任內存中動態創建的C字符串副本到我的飛地。因此,我必須使用[out, string]
屬性。爲什麼在SGX enclave字符串參數必須與[in]屬性配合使用
但是,我不能那樣做,因爲我還必須添加[in]
屬性。問題是我真的不知道字符串的大小,並且我不希望每次製作OCALL時都會從字符串不必要地複製字符串到不受信任的內存,從而導致開銷([in]
附帶)。
我EDL文件:
enclave {
trusted {
public void ecall_open(void);
};
untrusted {
void ocall_get_string([out, string] char* str);
};
};
error: string/wstring/sizefunc should be used with an 'in' attribute
爲什麼我要補充[in]
屬性?
出於性能的原因,有沒有辦法避免這種開銷?
開發者手冊上說 「'string'和'wstring'不能 用'單獨out'使用。」也許你可以讓你的OCALL使用自己的ECALL把數據發送到飛地,像這樣:'ocall_get_string()允許ecall_to_pass_string([in,string] char * str)''。在手冊中,這是寫在第59頁的標題*授予訪問ECALLs *。 – Daniel