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

Maximum size of the buffer allocated inside the Enclave

Meysam_t_
Beginner
380 Views

Dear All,

What is the maximum size of a buffer that we can allocate inside the enclave?

I mean if I am defining a function in my enclave.edl as follows

public void buffer_block_access([out, size=block_length]char*buffer, size_t block_length);

what is the maximum of "block_length" that I can define?

I malloc a buffer with the size of 2MB in my code like this 

const size_t SZ = 2097152;

char *buff = (char *)malloc(SZ*sizeof(char));

and when I call the function as mentioned bellow

 sgx_status_t stat = buffer_block_access(global_eid, buff, SZ);

It returns back

stat = 3

 

 

 

0 Kudos
1 Reply
Junli_S_Intel
Employee
380 Views

It will depends on two factors:

1. Your system's EPC size: you can modify and configure your EPC size in your system's BIOS

2. your enclave's configuration file(enclavename.config.xml):  this is one typical enclave configuration file:

<EnclaveConfiguration>
  <ProdID>0</ProdID>
  <ISVSVN>0</ISVSVN>
  <StackMaxSize>0x40000</StackMaxSize>
  <HeapMaxSize>0x100000</HeapMaxSize>
  <TCSNum>1</TCSNum>
  <TCSPolicy>1</TCSPolicy>
  <DisableDebug>0</DisableDebug>
  <MiscSelect>0</MiscSelect>
  <MiscMask>0xFFFFFFFF</MiscMask>
</EnclaveConfiguration>
Please pay attention to the high-light part. 

 

0 Kudos
Reply