diff --git a/docs/DesignDocs/SGX_QuoteEx_Integration.md b/docs/DesignDocs/SGX_QuoteEx_Integration.md index 24310f21dd..9237c55caf 100644 --- a/docs/DesignDocs/SGX_QuoteEx_Integration.md +++ b/docs/DesignDocs/SGX_QuoteEx_Integration.md @@ -65,7 +65,7 @@ The SGX ECDSA-p256 attester plugin is implemented in code file `enclave/sgx/attester.c` and other relevant enclave-side and host-side code files, called enclave-side and host-side plugin libraries in this document. he enclave-side plugin library interacts with the host-side plugin library -via OCALLs defined in interface definition file `common/sgx/sgx.edl`. +via OCALLs defined in interface definition file `edl/sgx/platform.edl`. For SGX ECDSA-p256 evidence generation, there are 2 OCALLs: - `oe_get_qetarget_info_ocall(sgx_target_info_t* target_info)` @@ -206,7 +206,7 @@ creates a list of attester plugins for them, and returns the created list to the caller. For SGX evidence formats enumeration, a new OCALL is added to interface -definition file `common/sgx/sgx.edl` and implemented in the host-side +definition file `edl/sgx/platform.edl` and implemented in the host-side SGX plugin library: - `oe_get_supported_attester_format_ids_ocall(void* format_ids, size_t format_ids_size, size_t* format_ids_size_out)` diff --git a/docs/DesignDocs/system_ocall_opt_in.md b/docs/DesignDocs/system_ocall_opt_in.md index 243334eb18..b23411e9e9 100644 --- a/docs/DesignDocs/system_ocall_opt_in.md +++ b/docs/DesignDocs/system_ocall_opt_in.md @@ -45,7 +45,7 @@ enclave } ``` -2. Import all OCalls from `tee.edl` +2. Import all OCalls from `core.edl` ``` // sample.edl @@ -66,8 +66,8 @@ enclave ``` In example (1), linking would fail if the enclave made a call to `oe_realloc_ocall()` -(also part of tee.edl) unless the developer modified the import line to -`from "openenclave/edl/tee.edl" import oe_log_ocall, oe_realloc_ocall;`. In this scenario, +(also part of core.edl) unless the developer modified the import line to +`from "openenclave/edl/core.edl" import oe_log_ocall, oe_realloc_ocall;`. In this scenario, example (2) will work without modification. ## EDL local structures @@ -122,18 +122,19 @@ The following 4 OCalls can be implemented in EDL, they just aren't today. Issue All system OCalls (other than the previously mentioned exceptions) are found in one of the following EDL files -* `common/logging.edl` -* `common/memory.edl` -* `common/epoll.edl` -* `common/fcntl.edl` -* `common/ioctl.edl` -* `common/poll.edl` -* `common/signal.edl` -* `common/socket.edl` -* `common/time.edl` -* `common/unistd.edl` -* `common/utsname.edl` -* `common/syscall.edl` -* `common/syscall.edl` -* `common/sgx/sgx.edl` -* `common/sgx/switchless.edl` +* `edl/logging.edl` +* `edl/memory.edl` +* `edl/epoll.edl` +* `edl/fcntl.edl` +* `edl/ioctl.edl` +* `edl/poll.edl` +* `edl/signal.edl` +* `edl/socket.edl` +* `edl/time.edl` +* `edl/unistd.edl` +* `edl/utsname.edl` +* `edl/sgx/cpu.edl` +* `edl/sgx/debug.edl` +* `edl/sgx/sgx_attestation.edl` +* `edl/sgx/switchless.edl` +* `edl/sgx/thread.edl` diff --git a/common/edl/asym_keys.edl b/edl/asym_keys.edl similarity index 100% rename from common/edl/asym_keys.edl rename to edl/asym_keys.edl diff --git a/common/edl/attestation.edl b/edl/attestation.edl similarity index 100% rename from common/edl/attestation.edl rename to edl/attestation.edl diff --git a/common/edl/tee.edl b/edl/core.edl similarity index 98% rename from common/edl/tee.edl rename to edl/core.edl index d1235831a6..e9fb817f56 100644 --- a/common/edl/tee.edl +++ b/edl/core.edl @@ -4,7 +4,7 @@ /* **============================================================================== ** -** tee.edl: +** core.edl: ** ** This file declares internal ECALLs/OCALLs used by liboehost/liboecore ** for usage with any TEE technology. diff --git a/common/edl/epoll.edl b/edl/epoll.edl similarity index 100% rename from common/edl/epoll.edl rename to edl/epoll.edl diff --git a/common/edl/fcntl.edl b/edl/fcntl.edl similarity index 100% rename from common/edl/fcntl.edl rename to edl/fcntl.edl diff --git a/common/edl/ioctl.edl b/edl/ioctl.edl similarity index 100% rename from common/edl/ioctl.edl rename to edl/ioctl.edl diff --git a/common/edl/keys.edl b/edl/keys.edl similarity index 100% rename from common/edl/keys.edl rename to edl/keys.edl diff --git a/common/edl/logging.edl b/edl/logging.edl similarity index 100% rename from common/edl/logging.edl rename to edl/logging.edl diff --git a/common/edl/memory.edl b/edl/memory.edl similarity index 100% rename from common/edl/memory.edl rename to edl/memory.edl diff --git a/edl/optee/platform.edl b/edl/optee/platform.edl new file mode 100644 index 0000000000..5dd0e06d76 --- /dev/null +++ b/edl/optee/platform.edl @@ -0,0 +1,20 @@ +// Copyright (c) Open Enclave SDK contributors. +// Licensed under the MIT License. + +/* +**============================================================================== +** +** optee/platform.edl: +** +** This is a temporary wrapper for aggregating all OPTEE-specific ECALLs and +** OCALLs for convenient use by oecore. +** +**============================================================================== +*/ + +enclave +{ + // There are currently no OP-TEE specific ocalls/ecalls which must be + // included. This file exists to allow an application to blindly include + // platform.edl and be compiled for any TEE. +}; diff --git a/common/edl/poll.edl b/edl/poll.edl similarity index 100% rename from common/edl/poll.edl rename to edl/poll.edl diff --git a/common/sgx/edl/cpu.edl b/edl/sgx/cpu.edl similarity index 100% rename from common/sgx/edl/cpu.edl rename to edl/sgx/cpu.edl diff --git a/common/sgx/edl/debug.edl b/edl/sgx/debug.edl similarity index 100% rename from common/sgx/edl/debug.edl rename to edl/sgx/debug.edl diff --git a/common/sgx/edl/sgx.edl b/edl/sgx/platform.edl similarity index 88% rename from common/sgx/edl/sgx.edl rename to edl/sgx/platform.edl index 1a20aa7143..90fd090da2 100644 --- a/common/sgx/edl/sgx.edl +++ b/edl/sgx/platform.edl @@ -4,7 +4,7 @@ /* **============================================================================== ** -** sgx/sgx.edl: +** sgx/platform.edl: ** ** This is a temporary wrapper for aggregating all SGX-specific ECALLs and ** OCALLs for convenient use by oecore. @@ -14,7 +14,7 @@ enclave { - from "attestation.edl" import *; + from "sgx_attestation.edl" import *; from "cpu.edl" import *; from "debug.edl" import *; from "thread.edl" import *; diff --git a/common/sgx/edl/attestation.edl b/edl/sgx/sgx_attestation.edl similarity index 98% rename from common/sgx/edl/attestation.edl rename to edl/sgx/sgx_attestation.edl index cd7a020d6c..0a16a4c076 100644 --- a/common/sgx/edl/attestation.edl +++ b/edl/sgx/sgx_attestation.edl @@ -4,7 +4,7 @@ /* **============================================================================== ** -** sgx/attestation.edl: +** sgx/sgx_attestation.edl: ** ** Internal ECALLs/OCALLs to be used by liboehost/liboecore for SGX-specific ** attestation. diff --git a/common/sgx/edl/switchless.edl b/edl/sgx/switchless.edl similarity index 100% rename from common/sgx/edl/switchless.edl rename to edl/sgx/switchless.edl diff --git a/common/sgx/edl/thread.edl b/edl/sgx/thread.edl similarity index 100% rename from common/sgx/edl/thread.edl rename to edl/sgx/thread.edl diff --git a/common/edl/signal.edl b/edl/signal.edl similarity index 100% rename from common/edl/signal.edl rename to edl/signal.edl diff --git a/common/edl/socket.edl b/edl/socket.edl similarity index 100% rename from common/edl/socket.edl rename to edl/socket.edl diff --git a/common/edl/syscall.edl b/edl/syscall.edl similarity index 100% rename from common/edl/syscall.edl rename to edl/syscall.edl diff --git a/common/edl/time.edl b/edl/time.edl similarity index 100% rename from common/edl/time.edl rename to edl/time.edl diff --git a/common/edl/unistd.edl b/edl/unistd.edl similarity index 100% rename from common/edl/unistd.edl rename to edl/unistd.edl diff --git a/common/edl/utsname.edl b/edl/utsname.edl similarity index 100% rename from common/edl/utsname.edl rename to edl/utsname.edl diff --git a/enclave/core/CMakeLists.txt b/enclave/core/CMakeLists.txt index 58e38b03be..53614362bb 100644 --- a/enclave/core/CMakeLists.txt +++ b/enclave/core/CMakeLists.txt @@ -1,9 +1,9 @@ # Copyright (c) Open Enclave SDK contributors. # Licensed under the MIT License. -set(EDL_DIR ${CMAKE_SOURCE_DIR}/common/edl) +set(EDL_DIR ${CMAKE_SOURCE_DIR}/edl) if (OE_SGX) - set(SGX_EDL_DIR ${CMAKE_SOURCE_DIR}/common/sgx/edl) + set(SGX_EDL_DIR ${EDL_DIR}/sgx) endif() ##============================================================================== @@ -13,15 +13,15 @@ endif() ## ##============================================================================== -set(TEE_EDL_FILE ${EDL_DIR}/tee.edl) +set(OECORE_EDL_FILE ${EDL_DIR}/core.edl) add_custom_command( - OUTPUT tee_t.h tee_t.c tee_args.h - DEPENDS ${TEE_EDL_FILE} edger8r - COMMAND edger8r --search-path ${EDL_DIR} --trusted ${TEE_EDL_FILE}) + OUTPUT core_t.h core_t.c core_args.h + DEPENDS ${OECORE_EDL_FILE} edger8r + COMMAND edger8r --search-path ${EDL_DIR} --trusted ${OECORE_EDL_FILE}) -add_custom_target(tee_trusted_edl - DEPENDS tee_t.h tee_t.c tee_args.h) +add_custom_target(core_trusted_edl + DEPENDS core_t.h core_t.c core_args.h) ##============================================================================== ## @@ -49,15 +49,14 @@ endif() ##============================================================================== if(OE_SGX) - set(SGX_EDL_FILE ${SGX_EDL_DIR}/sgx.edl) + set(SGX_EDL_FILE ${SGX_EDL_DIR}/platform.edl) add_custom_command( - OUTPUT sgx_t.h sgx_t.c sgx_args.h + OUTPUT platform_t.h platform_t.c platform_args.c DEPENDS ${SGX_EDL_FILE} edger8r COMMAND edger8r --search-path ${SGX_EDL_DIR} --trusted ${SGX_EDL_FILE}) - add_custom_target(sgx_trusted_edl - DEPENDS sgx_t.h sgx_t.c sgx_args.h) + add_custom_target(platform_trusted_edl DEPENDS platform_t.h platform_t.c platform_args.c) endif() ##============================================================================== @@ -106,7 +105,7 @@ if (OE_SGX) sgx/report.c sgx/sched_yield.c sgx/setjmp.S - sgx/sgx_t_wrapper.c + sgx/platform_t_wrapper.c sgx/spinlock.c sgx/switchless_t_wrapper.c sgx/switchlesscalls.c @@ -199,7 +198,7 @@ add_enclave_library(oecore STATIC string.c strtok_r.c strtoul.c - tee_t_wrapper.c + core_t_wrapper.c time.c tracee.c wchar.c @@ -236,9 +235,9 @@ set_property(SOURCE ${NEEDS_STDC_NAMES} APPEND PROPERTY maybe_build_using_clangw(oecore) -add_enclave_dependencies(oecore tee_trusted_edl) +add_enclave_dependencies(oecore core_trusted_edl) if(OE_SGX) - add_enclave_dependencies(oecore sgx_trusted_edl switchless_trusted_edl) + add_enclave_dependencies(oecore platform_trusted_edl switchless_trusted_edl) endif() enclave_include_directories(oecore PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/enclave/core/tee_t_wrapper.c b/enclave/core/core_t_wrapper.c similarity index 72% rename from enclave/core/tee_t_wrapper.c rename to enclave/core/core_t_wrapper.c index 792d5c0611..4aa2c63ee4 100644 --- a/enclave/core/tee_t_wrapper.c +++ b/enclave/core/core_t_wrapper.c @@ -10,8 +10,8 @@ #include /* Rename the global ecalls table. */ -#define __oe_ecalls_table __oe_tee_ecalls_table -#define __oe_ecalls_table_size __oe_tee_ecalls_table_size +#define __oe_ecalls_table __oe_core_ecalls_table +#define __oe_ecalls_table_size __oe_core_ecalls_table_size /* Override oe_call_host_function() calls with _call_host_function(). */ #define oe_call_host_function _call_host_function @@ -26,7 +26,7 @@ static oe_result_t _call_host_function( size_t* output_bytes_written) { return oe_call_host_function_by_table_id( - OE_TEE_OCALL_FUNCTION_TABLE_ID, + OE_CORE_OCALL_FUNCTION_TABLE_ID, function_id, input_buffer, input_buffer_size, @@ -38,14 +38,14 @@ static oe_result_t _call_host_function( /* Include the oeedger8r generated C file. The macros defined above customize * the generated code for internal use. */ -#include "tee_t.c" +#include "core_t.c" -/* Registers the tee ECALL function table. */ -oe_result_t oe_register_tee_ecall_function_table(void) +/* Registers the core ECALL function table. */ +oe_result_t oe_register_core_ecall_function_table(void) { - const uint64_t table_id = OE_TEE_ECALL_FUNCTION_TABLE_ID; - const oe_ecall_func_t* ecalls = __oe_tee_ecalls_table; - const size_t num_ecalls = __oe_tee_ecalls_table_size; + const uint64_t table_id = OE_CORE_ECALL_FUNCTION_TABLE_ID; + const oe_ecall_func_t* ecalls = __oe_core_ecalls_table; + const size_t num_ecalls = __oe_core_ecalls_table_size; return oe_register_ecall_function_table(table_id, ecalls, num_ecalls); } diff --git a/enclave/core/hostcalls.c b/enclave/core/hostcalls.c index 03e1df81a8..469c1af17b 100644 --- a/enclave/core/hostcalls.c +++ b/enclave/core/hostcalls.c @@ -12,7 +12,7 @@ #include #include "arena.h" -#include "tee_t.h" +#include "core_t.h" void* oe_host_malloc(size_t size) { diff --git a/enclave/core/optee/gp.c b/enclave/core/optee/gp.c index d69c613b80..205933bf65 100644 --- a/enclave/core/optee/gp.c +++ b/enclave/core/optee/gp.c @@ -13,7 +13,7 @@ #include "../atexit.h" #include "../calls.h" #include "../init_fini.h" -#include "tee_t.h" +#include "core_t.h" #include @@ -410,7 +410,7 @@ TEE_Result TA_CreateEntryPoint(void) oe_call_init_functions(); /* Install the common TEE ECALL function table. */ - if (oe_register_tee_ecall_function_table() != OE_OK) + if (oe_register_core_ecall_function_table() != OE_OK) return TEE_ERROR_GENERIC; /* Done */ diff --git a/enclave/core/sgx/backtrace.c b/enclave/core/sgx/backtrace.c index 8287ef394f..2394e93773 100644 --- a/enclave/core/sgx/backtrace.c +++ b/enclave/core/sgx/backtrace.c @@ -12,8 +12,8 @@ #include #include #include "../oe_nodebug_alloc.h" -#include "sgx_t.h" -#include "tee_t.h" +#include "core_t.h" +#include "platform_t.h" #if defined(__INTEL_COMPILER) #error "optimized __builtin_return_address() not supported by Intel compiler" diff --git a/enclave/core/sgx/calls.c b/enclave/core/sgx/calls.c index 654a0af2e7..771f43ae35 100644 --- a/enclave/core/sgx/calls.c +++ b/enclave/core/sgx/calls.c @@ -26,14 +26,14 @@ #include "../atexit.h" #include "../tracee.h" #include "asmdefs.h" +#include "core_t.h" #include "cpuid.h" #include "handle_ecall.h" #include "init.h" +#include "platform_t.h" #include "report.h" -#include "sgx_t.h" #include "switchlesscalls.h" #include "td.h" -#include "tee_t.h" oe_result_t __oe_enclave_status = OE_OK; uint8_t __oe_initialized = 0; @@ -160,10 +160,10 @@ static oe_result_t _handle_init_enclave(uint64_t arg_in) OE_CHECK(oe_register_switchless_ecall_function_table()); /* Install the common TEE ECALL function table. */ - OE_CHECK(oe_register_tee_ecall_function_table()); + OE_CHECK(oe_register_core_ecall_function_table()); /* Install the SGX ECALL function table. */ - OE_CHECK(oe_register_sgx_ecall_function_table()); + OE_CHECK(oe_register_platform_ecall_function_table()); if (!oe_is_outside_enclave(enclave, 1)) OE_RAISE(OE_INVALID_PARAMETER); diff --git a/enclave/core/sgx/cpuid.c b/enclave/core/sgx/cpuid.c index 4d37c315e8..027c37a5f3 100644 --- a/enclave/core/sgx/cpuid.c +++ b/enclave/core/sgx/cpuid.c @@ -7,7 +7,7 @@ #include #include #include -#include "sgx_t.h" +#include "platform_t.h" static uint32_t _cpuid_table[OE_CPUID_LEAF_COUNT][OE_CPUID_REG_COUNT]; diff --git a/enclave/core/sgx/sgx_t_wrapper.c b/enclave/core/sgx/platform_t_wrapper.c similarity index 80% rename from enclave/core/sgx/sgx_t_wrapper.c rename to enclave/core/sgx/platform_t_wrapper.c index 0ca271d720..87fb056150 100644 --- a/enclave/core/sgx/sgx_t_wrapper.c +++ b/enclave/core/sgx/platform_t_wrapper.c @@ -10,8 +10,8 @@ #include /* Rename the global ecalls table. */ -#define __oe_ecalls_table __oe_sgx_ecalls_table -#define __oe_ecalls_table_size __oe_sgx_ecalls_table_size +#define __oe_ecalls_table __oe_platform_ecalls_table +#define __oe_ecalls_table_size __oe_platform_ecalls_table_size /* Override oe_call_host_function() calls with _call_host_function(). */ #define oe_call_host_function _call_host_function @@ -38,14 +38,14 @@ static oe_result_t _call_host_function( /* Include the oeedger8r generated C file. The macros defined above customize * the generated code for internal use. */ -#include "sgx_t.c" +#include "platform_t.c" /* Registers the sgx ECALL function table. */ -oe_result_t oe_register_sgx_ecall_function_table(void) +oe_result_t oe_register_platform_ecall_function_table(void) { const uint64_t table_id = OE_SGX_ECALL_FUNCTION_TABLE_ID; - const oe_ecall_func_t* ecalls = __oe_sgx_ecalls_table; - const size_t num_ecalls = __oe_sgx_ecalls_table_size; + const oe_ecall_func_t* ecalls = __oe_platform_ecalls_table; + const size_t num_ecalls = __oe_platform_ecalls_table_size; return oe_register_ecall_function_table(table_id, ecalls, num_ecalls); } diff --git a/enclave/core/sgx/report.c b/enclave/core/sgx/report.c index 45873f3e30..5413d481db 100644 --- a/enclave/core/sgx/report.c +++ b/enclave/core/sgx/report.c @@ -13,7 +13,7 @@ #include #include #include -#include "sgx_t.h" +#include "platform_t.h" OE_STATIC_ASSERT(OE_REPORT_DATA_SIZE == sizeof(sgx_report_data_t)); diff --git a/enclave/core/sgx/thread.c b/enclave/core/sgx/thread.c index 787781b4c8..5a3ab6738e 100644 --- a/enclave/core/sgx/thread.c +++ b/enclave/core/sgx/thread.c @@ -9,7 +9,7 @@ #include #include #include -#include "sgx_t.h" +#include "platform_t.h" #include "td.h" /* diff --git a/enclave/core/tracee.c b/enclave/core/tracee.c index 483875367c..d4a0e19f90 100644 --- a/enclave/core/tracee.c +++ b/enclave/core/tracee.c @@ -15,7 +15,7 @@ #include #include #include -#include "tee_t.h" +#include "core_t.h" static oe_log_level_t _active_log_level = OE_LOG_LEVEL_ERROR; static char _enclave_filename[OE_MAX_FILENAME_LEN]; diff --git a/enclave/link.c b/enclave/link.c index 8410f68f9e..d08f46784b 100644 --- a/enclave/link.c +++ b/enclave/link.c @@ -3,7 +3,7 @@ #include #include -#include "tee_t.h" +#include "core_t.h" // // start.S (the compilation unit containing the entry point) contains a diff --git a/enclave/sgx/collateralinfo.c b/enclave/sgx/collateralinfo.c index c97008e3b8..f129a62571 100644 --- a/enclave/sgx/collateralinfo.c +++ b/enclave/sgx/collateralinfo.c @@ -10,7 +10,7 @@ #include #include #include "../common/sgx/collateral.h" -#include "sgx_t.h" +#include "platform_t.h" /** * Call into host to fetch collateral information. diff --git a/enclave/sgx/report.c b/enclave/sgx/report.c index 5c165b2734..38adeed475 100644 --- a/enclave/sgx/report.c +++ b/enclave/sgx/report.c @@ -14,7 +14,7 @@ #include #include #include "../common/sgx/quote.h" -#include "sgx_t.h" +#include "platform_t.h" OE_STATIC_ASSERT(OE_REPORT_DATA_SIZE == sizeof(sgx_report_data_t)); diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 432e97b45f..4594303b80 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -1,9 +1,9 @@ # Copyright (c) Open Enclave SDK contributors. # Licensed under the MIT License. -set(EDL_DIR ${CMAKE_SOURCE_DIR}/common/edl) +set(EDL_DIR ${CMAKE_SOURCE_DIR}/edl) if (OE_SGX) - set(SGX_EDL_DIR ${CMAKE_SOURCE_DIR}/common/sgx/edl) + set(SGX_EDL_DIR ${CMAKE_SOURCE_DIR}/edl/sgx) endif() ##============================================================================== @@ -13,15 +13,15 @@ endif() ## ##============================================================================== -set(TEE_EDL_FILE ${EDL_DIR}/tee.edl) +set(OECORE_EDL_FILE ${EDL_DIR}/core.edl) add_custom_command( - OUTPUT tee_u.h tee_u.c tee_args.h - DEPENDS ${TEE_EDL_FILE} edger8r - COMMAND edger8r --search-path ${EDL_DIR} --untrusted ${TEE_EDL_FILE}) + OUTPUT core_u.h core_u.c core_args.h + DEPENDS ${OECORE_EDL_FILE} edger8r + COMMAND edger8r --search-path ${EDL_DIR} --untrusted ${OECORE_EDL_FILE}) -add_custom_target(tee_untrusted_edl - DEPENDS tee_u.h tee_u.c tee_args.h) +add_custom_target(core_untrusted_edl + DEPENDS core_u.h core_u.c core_args.h) ##============================================================================== ## @@ -101,16 +101,15 @@ endif () ## ##============================================================================== +set(SGX_EDL_FILE ${SGX_EDL_DIR}/platform.edl) if (OE_SGX) - set(SGX_EDL_FILE ${SGX_EDL_DIR}/sgx.edl) - - add_custom_command( - OUTPUT sgx_u.h sgx_u.c sgx_args.h - DEPENDS ${SGX_EDL_FILE} edger8r - COMMAND edger8r --search-path ${SGX_EDL_DIR} --untrusted ${SGX_EDL_FILE}) + add_custom_command( + OUTPUT platform_u.h platform_u.c platform_args.c + DEPENDS ${SGX_EDL_FILE} edger8r + COMMAND edger8r --search-path ${SGX_EDL_DIR} --untrusted ${SGX_EDL_FILE}) - add_custom_target(sgx_untrusted_edl - DEPENDS sgx_u.h sgx_u.c sgx_args.h) + add_custom_target(platform_untrusted_edl + DEPENDS platform_u.h platform_u.c platform_args.c) endif () ##============================================================================== @@ -233,10 +232,10 @@ if (OE_SGX) sgx/load.c sgx/loadelf.c sgx/ocalls.c + sgx/platform_u_wrapper.c sgx/quote.c sgx/registers.c sgx/report.c - sgx/sgx_u_wrapper.c sgx/sgxload.c sgx/sgxmeasure.c sgx/sgxquote.c @@ -328,7 +327,7 @@ list(APPEND PLATFORM_SDK_ONLY_SRC syscall_u_wrapper.c signkey.c strings.c - tee_u_wrapper.c + core_u_wrapper.c traceh_enclave.c) # Combine the following common code along with the platform specific code and @@ -361,9 +360,9 @@ if (OE_SGX AND UNIX) endif () add_dependencies(oehost syscall_untrusted_edl) -add_dependencies(oehost tee_untrusted_edl) +add_dependencies(oehost core_untrusted_edl) if (OE_SGX) - add_dependencies(oehost sgx_untrusted_edl switchless_untrusted_edl) + add_dependencies(oehost platform_untrusted_edl switchless_untrusted_edl) endif () # TODO: Replace these with `find_package` and add as dependencies to diff --git a/host/asym_keys.c b/host/asym_keys.c index 1f743e6ead..222f239240 100644 --- a/host/asym_keys.c +++ b/host/asym_keys.c @@ -9,7 +9,7 @@ #include #include #include -#include "tee_u.h" +#include "core_u.h" /* This is the maximum default key buffer size. If the enclave produces * a key bigger than this, consider expanding this size so that the host diff --git a/host/tee_u_wrapper.c b/host/core_u_wrapper.c similarity index 64% rename from host/tee_u_wrapper.c rename to host/core_u_wrapper.c index 7fdc63e186..2db200dee1 100644 --- a/host/tee_u_wrapper.c +++ b/host/core_u_wrapper.c @@ -7,14 +7,14 @@ #include #include -/* Override oe_call_enclave_function() with _call_tee_enclave_function(). */ -#define oe_call_enclave_function _call_tee_enclave_function +/* Override oe_call_enclave_function() with _call_core_enclave_function(). */ +#define oe_call_enclave_function _call_core_enclave_function /* Obscure the generated creation function by renaming it. */ -#define oe_create_tee_enclave __unused_oe_create_tee_enclave +#define oe_create_tee_enclave __unused_oe_create_core_enclave /* The ocall edge routines will use this function to route ecalls. */ -static oe_result_t _call_tee_enclave_function( +static oe_result_t _call_core_enclave_function( oe_enclave_t* enclave, uint32_t function_id, const void* input_buffer, @@ -25,7 +25,7 @@ static oe_result_t _call_tee_enclave_function( { return oe_call_enclave_function_by_table_id( enclave, - OE_TEE_ECALL_FUNCTION_TABLE_ID, + OE_CORE_ECALL_FUNCTION_TABLE_ID, function_id, input_buffer, input_buffer_size, @@ -36,14 +36,14 @@ static oe_result_t _call_tee_enclave_function( /* Include the oeedger8r generated C file. The macros defined above customize * the generated code for internal use. */ -#include "tee_u.c" +#include "core_u.c" /* Registers the tee OCALL function table. */ -oe_result_t oe_register_tee_ocall_function_table(void) +oe_result_t oe_register_core_ocall_function_table(void) { - const uint64_t table_id = OE_TEE_OCALL_FUNCTION_TABLE_ID; - const oe_ocall_func_t* ocalls = __tee_ocall_function_table; - const size_t num_ocalls = OE_COUNTOF(__tee_ocall_function_table); + const uint64_t table_id = OE_CORE_OCALL_FUNCTION_TABLE_ID; + const oe_ocall_func_t* ocalls = __core_ocall_function_table; + const size_t num_ocalls = OE_COUNTOF(__core_ocall_function_table); return oe_register_ocall_function_table(table_id, ocalls, num_ocalls); } diff --git a/host/measure/CMakeLists.txt b/host/measure/CMakeLists.txt index 0a7ff58a33..0c20482841 100644 --- a/host/measure/CMakeLists.txt +++ b/host/measure/CMakeLists.txt @@ -99,9 +99,9 @@ if (WIN32) target_link_libraries(oehostmr PUBLIC crypt32) endif () -add_dependencies(oehostmr syscall_untrusted_edl tee_untrusted_edl) +add_dependencies(oehostmr syscall_untrusted_edl core_untrusted_edl) if (OE_SGX) - add_dependencies(oehostmr sgx_untrusted_edl switchless_untrusted_edl) + add_dependencies(oehostmr platform_untrusted_edl switchless_untrusted_edl) endif () # TODO: Replace these with `find_package` and add as dependencies to diff --git a/host/ocalls.c b/host/ocalls.c index c93149bd61..901dd1f98c 100644 --- a/host/ocalls.c +++ b/host/ocalls.c @@ -8,8 +8,8 @@ #include #include +#include "core_u.h" #include "ocalls.h" -#include "tee_u.h" void HandleMalloc(uint64_t arg_in, uint64_t* arg_out) { diff --git a/host/optee/linux/enclave.c b/host/optee/linux/enclave.c index 56b2946c64..b73c45d29d 100644 --- a/host/optee/linux/enclave.c +++ b/host/optee/linux/enclave.c @@ -82,7 +82,7 @@ OE_STATIC_ASSERT(TEEC_CONFIG_PAYLOAD_REF_COUNT >= 4); static void _initialize_enclave_host() { - oe_register_tee_ocall_function_table(); + oe_register_core_ocall_function_table(); oe_register_syscall_ocall_function_table(); } diff --git a/host/sgx/create.c b/host/sgx/create.c index 78420b9a54..a82d04ca0c 100644 --- a/host/sgx/create.c +++ b/host/sgx/create.c @@ -54,7 +54,7 @@ static char* get_fullpath(const char* path) #include "cpuid.h" #include "enclave.h" #include "exception.h" -#include "sgx_u.h" +#include "platform_u.h" #include "sgxload.h" #if !defined(OEHOSTMR) @@ -77,8 +77,8 @@ static void _initialize_enclave_host() { oe_once(&_enclave_init_once, _initialize_exception_handling); oe_register_switchless_ocall_function_table(); - oe_register_tee_ocall_function_table(); - oe_register_sgx_ocall_function_table(); + oe_register_core_ocall_function_table(); + oe_register_platform_ocall_function_table(); oe_register_syscall_ocall_function_table(); } #endif // OEHOSTMR diff --git a/host/sgx/ocalls.c b/host/sgx/ocalls.c index 773fe01619..d1b0b9fc43 100644 --- a/host/sgx/ocalls.c +++ b/host/sgx/ocalls.c @@ -29,8 +29,8 @@ #include "../ocalls.h" #include "enclave.h" #include "ocalls.h" +#include "platform_u.h" #include "quote.h" -#include "sgx_u.h" #include "sgxquoteprovider.h" void HandleThreadWait(oe_enclave_t* enclave, uint64_t arg_in) diff --git a/host/sgx/sgx_u_wrapper.c b/host/sgx/platform_u_wrapper.c similarity index 71% rename from host/sgx/sgx_u_wrapper.c rename to host/sgx/platform_u_wrapper.c index 5210c48d68..dd48138a73 100644 --- a/host/sgx/sgx_u_wrapper.c +++ b/host/sgx/platform_u_wrapper.c @@ -7,11 +7,12 @@ #include #include -/* Override oe_call_enclave_function() with _call_sgx_enclave_function(). */ -#define oe_call_enclave_function _call_sgx_enclave_function +/* Override oe_call_enclave_function() with _call_platform_enclave_function(). + */ +#define oe_call_enclave_function _call_platform_enclave_function /* The ocall edge routines will use this function to route ecalls. */ -static oe_result_t _call_sgx_enclave_function( +static oe_result_t _call_platform_enclave_function( oe_enclave_t* enclave, uint32_t function_id, const void* input_buffer, @@ -33,14 +34,14 @@ static oe_result_t _call_sgx_enclave_function( /* Include the oeedger8r generated C file. The macros defined above customize * the generated code for internal use. */ -#include "sgx_u.c" +#include "platform_u.c" /* Registers the sgx OCALL function table. */ -oe_result_t oe_register_sgx_ocall_function_table(void) +oe_result_t oe_register_platform_ocall_function_table(void) { const uint64_t table_id = OE_SGX_OCALL_FUNCTION_TABLE_ID; - const oe_ocall_func_t* ocalls = __sgx_ocall_function_table; - const size_t num_ocalls = OE_COUNTOF(__sgx_ocall_function_table); + const oe_ocall_func_t* ocalls = __platform_ocall_function_table; + const size_t num_ocalls = OE_COUNTOF(__platform_ocall_function_table); return oe_register_ocall_function_table(table_id, ocalls, num_ocalls); } diff --git a/host/sgx/report.c b/host/sgx/report.c index 873ca6a66a..5cbe738926 100644 --- a/host/sgx/report.c +++ b/host/sgx/report.c @@ -11,9 +11,9 @@ #include #include #include "../common/sgx/quote.h" +#include "core_u.h" +#include "platform_u.h" #include "quote.h" -#include "sgx_u.h" -#include "tee_u.h" #include "sgxquoteprovider.h" diff --git a/host/traceh_enclave.c b/host/traceh_enclave.c index f105f46a32..0f35a5fb71 100644 --- a/host/traceh_enclave.c +++ b/host/traceh_enclave.c @@ -16,7 +16,7 @@ #error "Open Enclave is not supported on this architecture." #endif -#include "tee_u.h" +#include "core_u.h" /* * This file is separated from traceh.c since the host verification library diff --git a/include/openenclave/internal/calls.h b/include/openenclave/internal/calls.h index 0957a2dd75..10ec356246 100644 --- a/include/openenclave/internal/calls.h +++ b/include/openenclave/internal/calls.h @@ -397,8 +397,8 @@ oe_result_t oe_ocall(uint16_t func, uint64_t arg_in, uint64_t* arg_out); **============================================================================== */ -#define OE_TEE_OCALL_FUNCTION_TABLE_ID 0 -#define OE_TEE_ECALL_FUNCTION_TABLE_ID 0 +#define OE_CORE_OCALL_FUNCTION_TABLE_ID 0 +#define OE_CORE_ECALL_FUNCTION_TABLE_ID 0 #define OE_SGX_OCALL_FUNCTION_TABLE_ID 1 #define OE_SGX_ECALL_FUNCTION_TABLE_ID 1 @@ -410,18 +410,18 @@ oe_result_t oe_ocall(uint16_t func, uint64_t arg_in, uint64_t* arg_out); #define OE_SWITCHLESS_ECALL_FUNCTION_TABLE_ID 3 /* Register the OCALL table needed by the common TEE interface (host side). */ -oe_result_t oe_register_tee_ocall_function_table(void); +oe_result_t oe_register_core_ocall_function_table(void); /* Register the ECALL table needed by the common TEE interface (enclave side). */ -oe_result_t oe_register_tee_ecall_function_table(void); +oe_result_t oe_register_core_ecall_function_table(void); /* Register the OCALL table needed by the SGX-specific interface (host side). */ -oe_result_t oe_register_sgx_ocall_function_table(void); +oe_result_t oe_register_platform_ocall_function_table(void); /* Register the ECALL table needed by the SGX-specific interface (enclave side). */ -oe_result_t oe_register_sgx_ecall_function_table(void); +oe_result_t oe_register_platform_ecall_function_table(void); /* Register the OCALL table needed by the SYSCALL interface (host side). */ void oe_register_syscall_ocall_function_table(void); diff --git a/syscall/CMakeLists.txt b/syscall/CMakeLists.txt index 584544fdd2..7c6038f13b 100644 --- a/syscall/CMakeLists.txt +++ b/syscall/CMakeLists.txt @@ -8,7 +8,7 @@ ## ##============================================================================== -set(EDL_DIR ${CMAKE_SOURCE_DIR}/common/edl) +set(EDL_DIR ${CMAKE_SOURCE_DIR}/edl) set(EDL_FILE ${EDL_DIR}/syscall.edl) add_custom_command(