Intel® Software Guard Extensions (Intel® SGX)
Discussion board focused on hardware-based isolation and memory encryption to provide extended code protection in solutions.

Sgx_seal_data_ex example code

glenn_t_
Beginner
1,299 Views
I would like to seal data to the enclave identity rather than the signer identity. I gather this has to be done using sgx_seal_data_ex but I am having trouble finding example code to use this. Does example code exist? Thanks
0 Kudos
4 Replies
Shivananda_H_Intel
1,299 Views

Hi,

You can refer to the below file for the usage of sgx_seal_data_ex. 

https://github.com/01org/linux-sgx/blob/master/sdk/tseal/tSeal.cpp

SGX_KEYPOLICY_MRSIGNER and SGX_KEYPOLICY_MRENCLAVE are defined in sgx_key.h

Regards

Shivananda

0 Kudos
Anusha_K_Intel
Employee
1,299 Views

Hi,

The syntax for the function is as follows

sgx_status_t sgx_seal_data_ex(
const uint16_t key_policy,
const sgx_attributes_t attribute_mask,
const sgx_misc_select_t misc_mask,
const uint32_t additional_MACtext_length,
const uint8_t * p_additional_MACtext,
const uint32_t text2encrypt_length,
const uint8_t * p_text2encrypt,
const uint32_t sealed_data_size,
sgx_sealed_data_t * p_sealed_data
);

In the sample code of sealed Data application we can see the usage of sgx_seal_data() function but sgx_seal_data_ex() is not used.You can see that code for reference.

The value of key_policy should be given as to 0x0001 to use the enclave's measurement register.

You need to add sgx_tseal.h as your header file and sgx_tservice.lib as your library.

More information regarding the function is given here: https://software.intel.com/en-us/node/709129 

0 Kudos
glenn_t_
Beginner
1,299 Views

So I define my function and internally define parameters  for the sgx_seal_data_ex.  The parameters i defined in my function seem to be lost. So if i have to pass all the arguments for seal_data_ex into my function its not clear how this should be defined in the .edl file. The documentation for .edl files does not say what the convention is for square brackets [].

0 Kudos
Anusha_K_Intel
Employee
1,299 Views

Hi,

What is the issue you are facing while giving the square brackets as input in the edl file??

 

 

0 Kudos
Reply