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

Error calling enclave function: 2 By passing typedef struct

jdafoe
Beginner
770 Views

Hi,

 

This is the trusted part of my Enclave.edl file:

 

enclave {

include "sharedTypes.h"
from "sgx_tstdc.edl" import *;
from "sgx_pthread.edl" import *;

trusted {

public void ecall_init();
public void ecall_file_init([in, string] const char *fileName,[out] Tag *tag,[out, size=10, count=numBlocks] uint8_t **sigma, int numBlocks);

 

And this is where the function ecall_file_init is called:

void app_file_init(sgx_enclave_id_t eid, const char *fileName, int numBlocks) {


// Initialize tag and sigma
Tag tag;

 

// First, allocate memory for the array of pointers
uint8_t **sigma = malloc(numBlocks * sizeof(uint8_t *));

// Then, allocate memory for each block of memory that each pointer points to
for (int i = 0; i < numBlocks; i++) {
sigma[i] = malloc((PRIME_LENGTH / * sizeof(uint8_t));

// Initialize each block of memory to 0
memset(sigma[i], 0, (PRIME_LENGTH / * sizeof(uint8_t));
}


sgx_status_t status;
// Call ecall_file_init to initialize tag and sigma
status = ecall_file_init(eid, fileName, &tag, sigma, numBlocks);
if (status != SGX_SUCCESS) {
printf("Error calling enclave function: %d\n", status);
return;
}

The Tag typedef struct:


typedef struct Tag {
int n;
uint8_t prfKey[KEY_SIZE];
uint8_t alpha[PAGE_PER_BLOCK][PRIME_LENGTH / 8];
uint8_t MAC[MAC_SIZE];
} Tag;

I am getting error #2 which indicates I am passing something into the ecall incorreclty. I suspect that it has something to do with tag. Any things I can try or solutions?

0 Kudos
4 Replies
KFPW_Intel
Moderator
709 Views

Hi jdafoe,


Thank you for your interest in Intel® SGX.


As I am looking around for error #2, could you share the screenshot of this error?


May I know what is your use cases in this status? -> status = ecall_file_init(eid, fileName, &tag, sigma, numBlocks);


Looking forward to hearing from you.


Regards,

Ken


0 Kudos
KFPW_Intel
Moderator
667 Views

Hi jdafoe,

 

I would like to follow up with you if you can share the screenshot of error #2 to assist your issue further.

 

Looking forward to hearing from you.

 

Thank you.

 

Regards,

Ken


0 Kudos
jdafoe
Beginner
653 Views

Hello, 

I have since figured out the issue. It turned out to be unrelated to the typedef struct.

 

Thanks.

0 Kudos
KFPW_Intel
Moderator
628 Views

Hi jdafoe,


I am glad to see that the issues that you faced have been solved.

This thread has been marked as solved and Intel will no longer monitor this thread. If you want a response from Intel in a follow-up question, please open a new thread.


Regards,

Ken


0 Kudos
Reply