创建一个Enclave的函数如下:
sgx_status_t sgx_create_enclave(
const char *file_name,
const int debug,
sgx_launch_token_t *launch_token,
int *launch_token_updated,
sgx_enclave_id_t *enclave_id,
sgx_misc_attribute_t *misc_attr
);
下面介绍一下每个变量的含义:
-
file_name: 名称或到enclave镜像的完整路径。如果项目使用Unicode,则文件明使用Unicode编码,如果项目使用多字节字符集,file_name应该是一个ANSI字符串。
-
debug [in]: 1表示在debug模式下创建enclave, 在调试模式下创建的enclave内的代码/数据内存可由调试器或enclave外的其他软件访问,不受Enclave保护。SGX_DEBUG_FLAG这个宏变量表示是否在Debug模式下创建Enclave,这个变量在makefile