Skip to content

Commit 41ea7b9

Browse files
authored
Upgrade to OE 0.12 (#153)
1 parent c190aae commit 41ea7b9

File tree

9 files changed

+37
-27
lines changed

9 files changed

+37
-27
lines changed

.github/scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ echo "deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic m
77
wget -qO - https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
88

99
sudo apt update
10-
sudo apt -y install clang-7 libssl-dev gdb libsgx-enclave-common libsgx-enclave-common-dev libprotobuf10 libsgx-dcap-ql libsgx-dcap-ql-dev az-dcap-client open-enclave=0.9.0
10+
sudo apt -y install clang-7 libssl-dev gdb libsgx-enclave-common libsgx-enclave-common-dev libprotobuf10 libsgx-dcap-ql libsgx-dcap-ql-dev az-dcap-client open-enclave=0.12.0
1111

1212
# Install Opaque Dependencies
1313
sudo apt -y install wget build-essential openjdk-8-jdk python libssl-dev

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ before_install:
1616
- sudo apt update
1717
- sudo apt -y install clang-7 libssl-dev gdb libsgx-enclave-common libsgx-enclave-common-dev libprotobuf10 libsgx-dcap-ql libsgx-dcap-ql-dev
1818
- sudo apt-get -y install wget build-essential openjdk-8-jdk python libssl-dev
19-
- sudo apt-get -y install open-enclave=0.9.0
19+
- sudo apt-get -y install open-enclave=0.12.0
2020
- wget https://github.com/Kitware/CMake/releases/download/v3.15.6/cmake-3.15.6-Linux-x86_64.sh
2121
- sudo bash cmake-3.15.6-Linux-x86_64.sh --skip-license --prefix=/usr/local
2222
- export PATH=/usr/local/bin:"$PATH"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ UDFs must be [implemented in C++](#user-defined-functions-udfs).
2424

2525
After downloading the Opaque codebase, build and test it as follows.
2626

27-
1. Install dependencies and the [OpenEnclave SDK](https://github.com/openenclave/openenclave/blob/v0.9.x/docs/GettingStartedDocs/install_oe_sdk-Ubuntu_18.04.md). We currently support OE version 0.9.0 (so please install with `open-enclave=0.9.0`) and Ubuntu 18.04.
27+
1. Install dependencies and the [OpenEnclave SDK](https://github.com/openenclave/openenclave/blob/v0.12.0/docs/GettingStartedDocs/install_oe_sdk-Ubuntu_18.04.md). We currently support OE version 0.12.0 (so please install with `open-enclave=0.12.0`) and Ubuntu 18.04.
2828

2929
```sh
3030
# For Ubuntu 18.04:

src/enclave/App/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ set(SOURCES
77
${CMAKE_CURRENT_BINARY_DIR}/Enclave_u.c)
88

99
add_custom_command(
10-
COMMAND oeedger8r --untrusted ${CMAKE_SOURCE_DIR}/Enclave/Enclave.edl --search-path ${CMAKE_SOURCE_DIR}/Enclave
10+
COMMAND oeedger8r --untrusted ${CMAKE_SOURCE_DIR}/Enclave/Enclave.edl
11+
--search-path ${CMAKE_SOURCE_DIR}/Enclave
12+
--search-path ${OE_INCLUDEDIR}
13+
--search-path ${OE_INCLUDEDIR}/openenclave/edl/sgx
1114
DEPENDS ${CMAKE_SOURCE_DIR}/Enclave/Enclave.edl
1215
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Enclave_u.h ${CMAKE_CURRENT_BINARY_DIR}/Enclave_u.c ${CMAKE_CURRENT_BINARY_DIR}/Enclave_args.h)
1316

@@ -22,6 +25,6 @@ if ("$ENV{MODE}" STREQUAL "SIMULATE")
2225
target_compile_definitions(enclave_jni PUBLIC -DSIMULATE)
2326
endif()
2427

25-
target_link_libraries(enclave_jni openenclave::oehost openenclave::oehostverify)
28+
target_link_libraries(enclave_jni openenclave::oehost)
2629

2730
install(TARGETS enclave_jni DESTINATION lib)

src/enclave/CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
cmake_minimum_required(VERSION 3.13)
22

33
project(OpaqueEnclave)
4-
54
enable_language(ASM)
65

76
option(FLATBUFFERS_LIB_DIR "Location of Flatbuffers library headers.")
87
option(FLATBUFFERS_GEN_CPP_DIR "Location of Flatbuffers generated C++ files.")
98

10-
find_package(OpenEnclave CONFIG REQUIRED)
9+
set(OE_MIN_VERSION 0.12.0)
10+
find_package(OpenEnclave ${OE_MIN_VERSION} CONFIG REQUIRED)
11+
12+
set(OE_CRYPTO_LIB
13+
mbed
14+
CACHE STRING "Crypto library used by enclaves.")
1115

1216
include_directories(App)
1317
include_directories(${CMAKE_BINARY_DIR}/App)
@@ -18,7 +22,7 @@ include_directories(${CMAKE_BINARY_DIR}/Enclave)
1822
include_directories(ServiceProvider)
1923
include_directories(${FLATBUFFERS_LIB_DIR})
2024
include_directories(${FLATBUFFERS_GEN_CPP_DIR})
21-
include_directories("/opt/openenclave/include")
25+
include_directories(${OE_INCLUDEDIR})
2226

2327
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
2428
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
@@ -31,14 +35,11 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -DDEBUG -UNDEBUG -UED
3135
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG -DEDEBUG -UDEBUG")
3236
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} -O2 -DNDEBUG -DEDEBUG -UDEBUG -DPERF")
3337

34-
message("openssl rsa -in $ENV{OPAQUE_HOME}/private_key.pem -pubout -out $ENV{OPAQUE_HOME}/public_key.pub")
35-
message("$ENV{OPAQUE_HOME}/public_key.pub")
36-
3738
add_custom_target(run ALL
3839
DEPENDS $ENV{OPAQUE_HOME}/public_key.pub)
3940

4041
add_custom_command(
41-
COMMAND openssl rsa -in $ENV{OPAQUE_HOME}/private_key.pem -pubout -out $ENV{OPAQUE_HOME}/public_key.pub
42+
COMMAND openssl rsa -in $ENV{PRIVATE_KEY_PATH} -pubout -out $ENV{OPAQUE_HOME}/public_key.pub
4243
OUTPUT $ENV{OPAQUE_HOME}/public_key.pub)
4344

4445
add_subdirectory(App)

src/enclave/Enclave/CMakeLists.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ set(SOURCES
2222
${CMAKE_CURRENT_BINARY_DIR}/Enclave_t.c)
2323

2424
add_custom_command(
25-
COMMAND oeedger8r --trusted ${CMAKE_SOURCE_DIR}/Enclave/Enclave.edl --search-path ${CMAKE_SOURCE_DIR}/Enclave
25+
COMMAND oeedger8r --trusted ${CMAKE_SOURCE_DIR}/Enclave/Enclave.edl
26+
--search-path ${CMAKE_SOURCE_DIR}/Enclave
27+
--search-path ${OE_INCLUDEDIR}
28+
--search-path ${OE_INCLUDEDIR}/openenclave/edl/sgx
2629
DEPENDS ${CMAKE_SOURCE_DIR}/Enclave/Enclave.edl
2730
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Enclave_t.h ${CMAKE_CURRENT_BINARY_DIR}/Enclave_t.c ${CMAKE_CURRENT_BINARY_DIR}/Enclave_args.h)
2831

@@ -41,22 +44,21 @@ endif()
4144
target_compile_definitions(enclave_trusted PUBLIC OE_API_VERSION=2)
4245

4346
# Need for the generated file Enclave_t.h
44-
target_include_directories(enclave_trusted PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
47+
target_include_directories(enclave_trusted PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${OE_INCLUDEDIR}/openenclave/3rdparty)
4548

46-
target_link_libraries(enclave_trusted
47-
openenclave::oeenclave
48-
openenclave::oelibc
49+
link_directories(${OE_LIBDIR} ${OE_LIBDIR}/openenclave/enclave)
50+
target_link_libraries(enclave_trusted
51+
openenclave::oeenclave
52+
openenclave::oecrypto${OE_CRYPTO_LIB}
53+
openenclave::oelibc
4954
openenclave::oelibcxx
50-
openenclave::oehostsock
51-
openenclave::oehostresolver)
55+
openenclave::oecore)
5256

5357
add_custom_command(
54-
COMMAND oesign sign -e $<TARGET_FILE:enclave_trusted> -c ${CMAKE_CURRENT_SOURCE_DIR}/Enclave.conf -k $ENV{PRIVATE_KEY_PATH}
58+
COMMAND openenclave::oesign sign -e $<TARGET_FILE:enclave_trusted> -c ${CMAKE_CURRENT_SOURCE_DIR}/Enclave.conf -k $ENV{PRIVATE_KEY_PATH}
5559
DEPENDS enclave_trusted ${CMAKE_CURRENT_SOURCE_DIR}/Enclave.conf
5660
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/enclave_trusted.signed)
5761

58-
# TODO: Use the user-generated private key to sign the enclave code.
59-
# Currently we use the sample private key from the Intel SGX SDK.
6062
add_custom_command(
6163
COMMAND mv ${CMAKE_CURRENT_BINARY_DIR}/libenclave_trusted.so.signed ${CMAKE_CURRENT_BINARY_DIR}/libenclave_trusted_signed.so
6264
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/enclave_trusted.signed

src/enclave/Enclave/Enclave.edl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
enclave {
55

6+
from "openenclave/edl/syscall.edl" import *;
7+
from "platform.edl" import *;
8+
69
include "stdbool.h"
710

811
trusted {

src/enclave/ServiceProvider/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ set(SOURCES
1212
iasrequest.cpp
1313
sp_crypto.cpp)
1414

15-
link_directories("$ENV{OE_SDK_PATH}/lib/openenclave/enclave")
16-
include_directories("$ENV{OE_SDK_PATH}/include")
17-
include_directories("$ENV{OE_SDK_PATH}/include/openenclave/3rdparty")
15+
link_directories(${OE_LIBDIR})
16+
link_directories(${OE_LIBDIR}/openenclave/enclave)
17+
include_directories(${OE_INCLUDEDIR})
18+
include_directories(${OE_INCLUDEDIR}/openenclave/3rdparty)
1819

1920
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wno-attributes")
2021
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
@@ -27,6 +28,6 @@ endif()
2728

2829
find_library(CRYPTO_LIB crypto)
2930
find_library(SSL_LIB ssl)
30-
target_link_libraries(ra_jni "${CRYPTO_LIB}" "${SSL_LIB}" mbedcrypto mbedtls openenclave::oehost openenclave::oehostverify)
31+
target_link_libraries(ra_jni ${CRYPTO_LIB} ${SSL_LIB} mbedcrypto mbedtls openenclave::oehost)
3132

3233
install(TARGETS ra_jni DESTINATION lib)

src/enclave/ServiceProvider/sp_crypto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
#include <stdint.h>
4444
#include <cstring>
45-
#include <sys/errno.h>
45+
#include <errno.h>
4646

4747
#include "openssl/evp.h"
4848
#include "openssl/pem.h"

0 commit comments

Comments
 (0)