Skip to content

Commit

Permalink
libsgxstep: remove dependency on Intel SDK headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
jovanbulck committed Oct 13, 2022
1 parent 2eba798 commit e6a8a95
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 15 deletions.
1 change: 0 additions & 1 deletion libsgxstep/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ ifeq ($(M32), 1)
CFLAGS += -m32 -DM32=1
endif

INCLUDE = -I$(SGX_SDK)/include/
SOURCES = $(shell ls *.c)
ASM = $(shell ls *.S)
OBJECTS = $(SOURCES:.c=.o) $(ASM:.S=.o)
Expand Down
4 changes: 1 addition & 3 deletions libsgxstep/debug.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "debug.h"

#if !NO_SGX
sgx_status_t sgx_step_rv = SGX_SUCCESS;
#endif
int sgx_step_rv = 0;

void dump_hex(uint8_t *buf, int len)
{
Expand Down
8 changes: 2 additions & 6 deletions libsgxstep/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,14 @@
#include <stdint.h>
#include "config.h"

#if !NO_SGX
#include <sgx_error.h>
extern int sgx_step_rv;

extern sgx_status_t sgx_step_rv;

#define SGX_ASSERT(f) { if ( SGX_SUCCESS != (sgx_step_rv = (f)) ) \
#define SGX_ASSERT(f) { if ( 0 != (sgx_step_rv = (f)) ) \
{ \
printf( "Error calling enclave at %s:%d (rv=0x%x)\n", __FILE__, \
__LINE__, sgx_step_rv); \
abort(); \
} }
#endif

#define ASSERT(cond) \
do { \
Expand Down
6 changes: 4 additions & 2 deletions libsgxstep/enclave.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
#include <fcntl.h>
#include <string.h>

/* Includes custom AEP get/set functions from patched SGX SDK urts. */
#include <sgx_urts.h>
/* Custom AEP get/set functions from patched SGX SDK urts. */
void* sgx_get_aep(void);
void sgx_set_aep(void* aep);
void* sgx_get_tcs(void);

/* See aep_trampoline.S to see how these are used. */
extern void sgx_step_aep_trampoline(void);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ diff --git a/pal/src/host/linux-sgx/meson.build b/pal/src/host/linux-sgx/meson.b
index 3e77bdcc..a1776fb8 100644
--- a/pal/src/host/linux-sgx/meson.build
+++ b/pal/src/host/linux-sgx/meson.build
@@ -152,10 +152,21 @@ libpal_sgx_host = executable('loader',
@@ -152,10 +152,19 @@ libpal_sgx_host = executable('loader',
# host part of PAL uses stack protector with standard parameters (not the ones defined for
# PAL/LibOS)
'-fstack-protector-strong',
Expand All @@ -123,8 +123,6 @@ index 3e77bdcc..a1776fb8 100644
+ '-I../../../..',
+ # XXX FORTIFY_SOURCE conflicts with regular libc header includes in libsgxstep
+ '-D_FORTIFY_SOURCE=0',
+ # XXX libsgxstep needs Intel SDK headers (only for error reporting; can be hacked out if needed)
+ '-I/opt/intel/sgxsdk/include/'
],
link_args: [
'-Wl,-zrelro',
Expand Down

0 comments on commit e6a8a95

Please sign in to comment.