什么样的Python包装器适合将incla sgx中的安全区代码包装起来,以及如何使用它?
我尝试使用ctypes和pybind11
app.cpp:
int makeAcallHere()
{
sgx_enclave_id_t eid;
sgx_status_t ret = SGX_SUCCESS;
sgx_launch_token_t token = { 0 };
int updated = 0;
// Create the Enclave with above launch token.
ret = sgx_create_enclave(ENCLAVE_FILE, SGX_DEBUG_FLAG,
&token, &updated,&eid, NULL);
cout << eid;
if (ret != SGX_SUCCESS) {
printf("App: error %#x, failed to create enclave.\n",ret);
return -1;
}
char * buf = "hello";
in(eid,buf); //calling enclave function
return 0;
}
enclave.cpp:
#include "app.h"
#include "sgx_trts.h"
#include <string.h>
static char* _hi = "hello";
void in(char* hi) {
memcpy(_hi, hi, strlen(_hi) + 1);
}
我希望在app.cpp中调用c ++函数,然后在enclave.cpp中调用enclave函数。