I am trying to pass two integers to the SGX enclave, combine them and then return the result back to the application. However, nothing seems to happen when compiling the code aside from the enclave getting created. No error given and it seemingly never reaches the ECALL function.
If anyone is aware of a tutorial that does this that I can use as reference then that would be hugely appreciated.
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);
};
};
Enclave.cpp
int in_enclave(int* a, int* b){
ocall_print("In the Enclave.");
int result =0;
result = a + b;
ocall_print_int(&result);
}
App.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; }