I am trying to compute a key pair fro establishing communication by call an ECALL to the enclave to compute the key pairs and return the public key back to the App. But it seems that it doesn't populate the public key pointer as it needs to.
EDL:
public int ecall_generate_key_pair([out] sgx_ec256_public_t * key);
App.cpp:
sgx_ec256_public_t u_public_key;
int ret = 0;
printf("The einitial public key %u %u
", u_public_key.gx, u_public_key.gy);
ret = ecall_generate_key_pair(global_eid, &ret_status, &u_public_key, key_size);
if( ret != 0) {
std::cout << "Key generation failed" << std::endl;
abort();
}
printf("The ecall returned this public key %u %u
", u_public_key.gx, u_public_key.gy);
Enclave:
sgx_ec256_private_t t_private_key;
sgx_ec256_public_t t_public_key;
int ecall_generate_key_pair(sgx_ec256_public_t * key, size_t key_size){
sgx_status_t res;
sgx_ecc_state_handle_t t_ecc_handle;
res = sgx_ecc256_open_context(&t_ecc_handle);
if ( res != SGX_SUCCESS) {
printf("Couldn't open context
");
return -1;
}
//Keys are global for Enclave
res = sgx_ecc256_create_key_pair(&t_private_key, &t_public_key, t_ecc_handle);
if ( res != SGX_SUCCESS) {
printf("Couldn't generate key pair (alice)
");
return -1;
}
sgx_ecc256_close_context(t_ecc_handle);
*key = t_public_key;
return 0;}
I forgot to put the print of the generated key in the code. It is meaningful.
If you could help me out it would be awesome!
question from:
https://stackoverflow.com/questions/65921025/struct-isnt-populated-from-enclave-back-to-app-through-ecallintel-sgx 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…