将C ++结构传递给Intel SGX中的应用程序

编程入门 行业动态 更新时间:2024-10-27 23:32:31
本文介绍了将C ++结构传递给Intel SGX中的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个像这样的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中的应用程序

本文发布于:2023-11-16 07:47:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1602367.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   结构   Intel   SGX

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!