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

How to Work With Nested Includes on .edl files

Guy_M_
Novice
973 Views

 

Hi

Assuming I have an "enclave.edl" file and  two header files "definitions1.h" and "definitions2.h"

when I use "second_type" from "definitions2.h" in my "enclave.edl" it does not recognize it,
but when I use "first_type" from "definitions1.h" it works fine.

why does that happen, and how can I make it work?

(I can put all my definitions in the first header file but it creates a big mess.)
 

enclave.edl
enclave
{
#include "definitions1.h"
    
    trusted 
    {   
          ecallFoo(second_type test);
    };

    untrusted 
    {

    };
};

definitions1.h
#ifndef TRUSTED_DEFINITIONS1_H_
#define TRUSTED_DEFINITIONS1_H_

#include "definitions2.h"
#define first_type int

#endif /* TRUSTED_DEFINITIONS1_H_ */


definitions2.h
#ifndef TRUSTED_DEFINITION2_H_
#define TRUSTED_DEFINITION2_H_

#define second_type int

#endif /* TRUSTED_DEFINITION2_H_ */

 

 
 
0 Kudos
1 Reply
Hoang_N_Intel
Employee
973 Views

The nested header file should work. There are a couple of issues of the code that you provided:

1. In the EDL trusted part, you should declare the function as public and have a return type such as

trusted
{  
    public void ecallFoo(second_type test);
};

 

2. Please remember that the EDL gets compiled so any definition of "#define second_type int" is translated back into "int" in the generated code. If you want to use second_type again, you simply need to add the "include" statement in the c/cpp file again such as

#include "definitions1.h" or #include "definitions2.h"

Please give a try and see whether the changes help.

Thanks,

0 Kudos
Reply