我正在尝试将两个整数传递给 SGX 飞地,将它们组合起来,然后将结果返回给应用程序。但是,除了创建飞地之外,编译代码时似乎什么都没有发生。没有给出错误,它似乎永远不会到达 ECALL 函数。
如果有人知道这样做的教程,我可以用作参考,那将不胜感激。
EDL:
enclave {
from "sgx_tae_service.edl" import *;
/* enum definition */
enum TEE_ERROR {
TEE_ERROR_INVALID_SIGNATURE = 0,
TEE_ERROR_INVALID_COUNTER = 1,
TEE_ERROR_INVALID_SECRET = 2
};
trusted {
/* define ECALLs here. */
public int in_enclave([in] int* a, [in] int* b);
};
untrusted {
/* define OCALLs here. */
void ocall_print_int([out] int* i);
};
};
飞地.cpp
int in_enclave(int* a, int* b){
ocall_print("In the Enclave.");
int result =0;
result = a + b;
ocall_print_int(&result);
}
应用程序.cpp
int test(void) {
if (initialize_enclave(&global_eid, "enclave.token", "enclave.signed.so") < 0) {
std::cout << "Fail to initialize enclave." << std::endl;
return 1;
}else{
std::cout<<"Enclave made. "<<"\n";
}
int a =34, b =23,point = 0;
in_enclave(global_eid,&point,&a,&b);
return 0; }