-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-factor SGX directory structure #588
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
include/sgx/crypto/encryption.h → include/enclave/inside/crypto/encryption.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
include/sgx/crypto/hash.h → include/enclave/inside/crypto/hash.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#pragma once | ||
|
||
#include <sgx/crypto/types.h> | ||
#include <enclave/inside/crypto/types.h> | ||
|
||
#include <sgx_tcrypto.h> | ||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#pragma once | ||
|
||
#include <sgx/error.h> | ||
#include <enclave/error.h> | ||
|
||
#include <sgx_eid.h> | ||
#include <sgx_error.h> | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# -------------------------------------------------------- | ||
# SGX Config and Checks Shared Between Trusted/Untrusted Builds | ||
# -------------------------------------------------------- | ||
|
||
# SGX configuration | ||
set(SGX_SDK_LIB_PATH ${SGX_SDK_PATH}/lib64) | ||
set(SGX_SDK_ENCLAVE_SIGNER ${SGX_SDK_PATH}/bin/x64/sgx_sign) | ||
set(SGX_SDK_ENCLAVE_EDGER8R ${SGX_SDK_PATH}/bin/x64/sgx_edger8r) | ||
set(ENCLAVE_PATH "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/enclave_trusted.sign.so") | ||
set(ENCLAVE_EDL_FILENAME "enclave") | ||
add_definitions(-DFAASM_ENCLAVE_PATH="${ENCLAVE_PATH}") | ||
|
||
# Check for SGX SDK | ||
set(THREADS_PREFER_PTHREAD_FLAG ON) | ||
find_package(Threads REQUIRED) | ||
if(EXISTS ${SGX_SDK_PATH}) | ||
message(STATUS "Found SGX-SDK: TRUE") | ||
else() | ||
message(STATUS "Found SGX-SDK: FALSE") | ||
message(FATAL_ERROR "SGX-SDK not installed in ${SGX_SDK_PATH}") | ||
endif() | ||
|
||
# NASM configuration | ||
enable_language(ASM_NASM) | ||
set(CMAKE_ASM_NASM_FLAGS -felf64) | ||
set(CMAKE_ASM_NASM_COMPILE_OBJECT | ||
"<CMAKE_ASM_NASM_COMPILER> <INCLUDES> ${CMAKE_ASM_NASM_FLAGS} -o <OBJECT> <SOURCE>" | ||
) | ||
|
||
# -------------------------------------------------------- | ||
# Global SGX Compilation Flags | ||
# -------------------------------------------------------- | ||
|
||
set(SGX_C_GLOBAL_FLAGS -m64) | ||
|
||
if(CMAKE_BUILD_TYPE EQUAL "Debug") | ||
set(SGX_C_GLOBAL_FLAGS ${SGX_C_GLOBAL_FLAGS} -O0 -g) | ||
|
||
add_definitions(-DFAASM_SGX_DEBUG) | ||
else() | ||
set(SGX_C_GLOBAL_FLAGS ${SGX_C_GLOBAL_FLAGS} -O2) | ||
endif() | ||
|
||
|
||
# -------------------------------------------------------- | ||
# WAMR Build Common For Trusted and Untrusted | ||
# | ||
# 28/06/2021 - To build WAMR inside SGX, we follow the provided example: | ||
# https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/product-mini/platforms/linux-sgx/CMakeLists.txt | ||
# -------------------------------------------------------- | ||
|
||
# Set target platform details | ||
set(WAMR_BUILD_PLATFORM "linux-sgx") | ||
set(WAMR_BUILD_TARGET X86_64) | ||
set(WAMR_BUILD_SPEC_TEST) | ||
|
||
# Set AOT mode, disable JIT | ||
set(WAMR_BUILD_AOT 1) | ||
set(WAMR_BUILD_JIT 0) | ||
set(WAMR_BUILD_LAZY_JIT 0) | ||
|
||
# Set libraries | ||
set(WAMR_BUILD_LIBC_BUILTIN 1) | ||
set(WAMR_BUILD_LIBC_WASI 0) | ||
set(WAMR_BUILD_LIB_PTHREAD 0) | ||
|
||
# Let WAMR do the including and importing of the sources | ||
include(${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) | ||
|
||
# WAMR Trusted lib | ||
faasm_private_lib(wamrlib_trusted "${WAMR_RUNTIME_LIB_SOURCE}") | ||
|
||
target_include_directories(wamrlib_trusted PRIVATE | ||
${SGX_SDK_PATH}/include | ||
${SGX_SDK_PATH}/include/tlibc | ||
${SGX_SDK_PATH}/include/libcxx | ||
) | ||
|
||
target_compile_options(wamrlib_trusted PRIVATE | ||
-std=gnu99 | ||
-fPIC | ||
-ffunction-sections | ||
-fdata-sections | ||
-Wall | ||
-Wno-unused-parameter | ||
-Wno-pedantic | ||
-nostdinc | ||
-fvisibility=hidden | ||
) | ||
|
||
# WAMR untrusted lib | ||
add_library(wamrlib_untrusted STATIC ${PLATFORM_SHARED_SOURCE_UNTRUSTED}) | ||
|
||
target_compile_options(wamrlib_untrusted PRIVATE | ||
-fPIC | ||
-ffunction-sections | ||
-fdata-sections | ||
) | ||
|
||
# -------------------------------------------------------- | ||
# Trusted Enclave Library | ||
# -------------------------------------------------------- | ||
add_subdirectory(inside) | ||
|
||
# -------------------------------------------------------- | ||
# Untrusted Enclave Library | ||
# -------------------------------------------------------- | ||
add_subdirectory(outside) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class member was defined in
attestation.h
and was not used.