我有一个像这样的C ++结构:
I have a C++ struct like this:
struct node { string splitOn; string label; bool isLeaf; vector<string> childrenValues; vector<node*> children; };我想将此内容从App传递或阅读到英特尔SGX飞地.根据此处提到的内容: software.intel/zh-CN/forums/intel-software-guard-extensions-intel-sgx/topic/703489
I wanted to pass or read this from App to the Intel SGX enclave. Based on what is mentioned here: software.intel/en-us/forums/intel-software-guard-extensions-intel-sgx/topic/703489
我尝试过:
APP:
node *root = new node; root = buildDecisionTree(dataTable, root, *tableInfo); //this initializes the root void *data3 = static_cast<void*>(root); ecall_my_dtree(global_eid, &ecall_return, data3);EDL:
public int ecall_my_dtree([user_check] void* data);飞地:
int ecall_my_dtree(void *data2) node* root2 = static_cast<node*>(data2);但是似乎root2无法正确初始化,并且指向垃圾.
But it seems, the root2 is not able to initialize properly and it points to garbage.
关于user_check: software.intel/zh-cn/node /708978
About user_check: software.intel/en-us/node/708978
有关如何正确读取安全区内数据的任何帮助. PS:Intel SGX enclave不支持任何序列化库.
Any help regarding how I could properly read the data inside the enclave. PS: Intel SGX enclave does not support any serialization library.
我在这里也曾问过类似的问题,但对于我的小脑袋却没有真正有用的答案. github/intel/linux-sgx/issues/229
I have asked the similar question here too but no real helpful answer for my small brain. github/intel/linux-sgx/issues/229
推荐答案您不应这样做:
struct node { string splitOn; string label; bool isLeaf; vector<string> childrenValues; vector<node*> children; };可能的问题:
-
STL不保证大多数类型的二进制兼容性:即std::string或std::vector.
SGX对STL的实现只是其修改/精简的子集.
SGX's implementation of the STL is just a modified/reduced subset of it.
您可能会遇到与内存对齐有关的问题.
You may face problems related to memory alignment.
您应该为此实现自定义序列化.
You should implement custom serialization for this instead.
更多推荐
将C ++结构传递给Intel SGX中的应用程序
发布评论