From 3140f6585e76e3a64772d3dfbd21fc04beb8407b Mon Sep 17 00:00:00 2001 From: "Christoph M. Wintersteiger" Date: Tue, 15 Sep 2020 17:30:00 +0000 Subject: [PATCH] Trim oe_ecompat.h Signed-off-by: Christoph M. Wintersteiger --- src/include/host/env.h | 2 +- src/include/shared/oe_compat.h | 1 - src/include/shared/shared_memory.h | 2 -- src/shared/sgxlkl_enclave_config.c | 10 ++++++++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/include/host/env.h b/src/include/host/env.h index 0d7d997fc..0ba810b0c 100644 --- a/src/include/host/env.h +++ b/src/include/host/env.h @@ -1,7 +1,7 @@ #ifndef _ENV_H #define _ENV_H -#include "shared/oe_compat.h" +#include uint64_t size_str_to_uint64(const char* str, uint64_t def, uint64_t max); diff --git a/src/include/shared/oe_compat.h b/src/include/shared/oe_compat.h index cbacb4215..5adf4e790 100644 --- a/src/include/shared/oe_compat.h +++ b/src/include/shared/oe_compat.h @@ -28,7 +28,6 @@ #include #include -#include #include #include #include diff --git a/src/include/shared/shared_memory.h b/src/include/shared/shared_memory.h index 41cbee9cc..9b3298335 100644 --- a/src/include/shared/shared_memory.h +++ b/src/include/shared/shared_memory.h @@ -1,8 +1,6 @@ #ifndef SGXLKL_SHARED_MEMORY_H #define SGXLKL_SHARED_MEMORY_H -#include "shared/oe_compat.h" - #include typedef struct sgxlkl_shared_memory diff --git a/src/shared/sgxlkl_enclave_config.c b/src/shared/sgxlkl_enclave_config.c index 9e39a132e..2ea160a35 100644 --- a/src/shared/sgxlkl_enclave_config.c +++ b/src/shared/sgxlkl_enclave_config.c @@ -539,8 +539,18 @@ const sgxlkl_enclave_config_page_t* sgxlkl_read_enclave_config( size_t num_pages = (strlen(from) / OE_PAGE_SIZE) + 1; sgxlkl_enclave_config_page_t* config_page = +#ifdef SGXLKL_ENCLAVE memalign(OE_PAGE_SIZE, num_pages * OE_PAGE_SIZE); +#else + malloc(num_pages * OE_PAGE_SIZE); +#endif + +#ifdef SGXLKL_ENCLAVE + oe_memset_s(config_page, OE_PAGE_SIZE, 0, OE_PAGE_SIZE); +#else memset(config_page, 0, OE_PAGE_SIZE); +#endif + if (!config_page) FAIL("out of memory\n"); config_page->config = sgxlkl_enclave_config_default;