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

sgx_ecall read access violation

Caprioli__Nico
Beginner
387 Views
Through SGX EDL I defined this signature for computing a digital signature:
 
trusted {
    public void enc_sign([in, size=messageLength] Ipp8u* message, unsigned messageLength,
    [out, size=outputLength] Ipp8u* output, unsigned outputLength, unsigned saltLength, int signBufferSize,
    [in, size=publicLength] IppsRSAPublicKeyState* publicKeyContext, int publicLength,
    [in, size=privateLength] IppsRSAPrivateKeyState* privateKeyContext, int privateLength);
};

I don't think that the code of the function itself is relevant as outside of an enclave it works well.

 
SGX SDK then autogenerates untrusted proxy code which is in charge to perform the ecall; however, I am getting an error.
 
The autogenerated code is the following (just the relevant part):
 
sgx_status_t enc_sign(sgx_enclave_id_t eid, Ipp8u* message,
  unsigned int messageLength, Ipp8u* output, unsigned int outputLength,
  unsigned int saltLength, int signBufferSize,
  IppsRSAPublicKeyState* publicKeyContext, int publicLength,
  IppsRSAPrivateKeyState* privateKeyContext, int privateLength)
{
    sgx_status_t status;
    ms_enc_sign_t ms;
    ms.ms_message = message;
    ms.ms_messageLength = messageLength;
    ms.ms_output = output;
    ms.ms_outputLength = outputLength;
    ms.ms_saltLength = saltLength;
    ms.ms_signBufferSize = signBufferSize;
    ms.ms_publicKeyContext = publicKeyContext;
    ms.ms_publicLength = publicLength;
    ms.ms_privateKeyContext = privateKeyContext;
    ms.ms_privateLength = privateLength;
    status = sgx_ecall(eid, 0, &ocall_table_ESigner, &ms);
    return status;
}

This code, in particular the line status = sgx_ecall(eid, 0, &ocall_table_ESigner, &ms); causes me an access violation: read to address 0x00000000.

 
I double checked it, and eid ocall_table_ESigner and ms are not null. Moreover changing the second parameter to any other number makes the error disappear, so I am assuming that is is a function index problem.
 
Still, no clue on how to solve it.
0 Kudos
0 Replies
Reply