Skip to content

Commit 542bba8

Browse files
Initial removal of SGX targets (#6426)
Co-authored-by: Amaury Chamayou <[email protected]>
1 parent 4bb3c1e commit 542bba8

35 files changed

+47
-721
lines changed

.github/workflows/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ File: `ci-containers-ghcr.yml`
3030

3131
# CI
3232

33-
Main continuous integration job. Builds CCF for all target platforms, runs unit, end to end and partition tests for SGX and Virtual. Run on every commit, including PRs from forks, gates merging. Also runs once a week, regardless of commits.
33+
Main continuous integration job. Builds CCF for all target platforms, runs unit, end to end and partition tests Virtual. Run on every commit, including PRs from forks, gates merging. Also runs once a week, regardless of commits.
3434

3535
File: `ci.yml`
3636
3rd party dependencies: None

.github/workflows/ci.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ jobs:
4242
image: default
4343
nodes: [self-hosted, 1ES.Pool=gha-virtual-ccf-sub]
4444
options: --user root --publish-all --cap-add NET_ADMIN --cap-add NET_RAW --cap-add SYS_PTRACE -v /lib/modules:/lib/modules:ro
45-
- name: sgx
46-
image: sgx
47-
nodes: [self-hosted, 1ES.Pool=gha-sgx-ccf-sub]
48-
options: --user root --publish-all --cap-add NET_ADMIN --cap-add NET_RAW --device /dev/sgx_enclave:/dev/sgx_enclave --device /dev/sgx_provision:/dev/sgx_provision -v /dev/sgx:/dev/sgx -v /lib/modules:/lib/modules:ro
4945
runs-on: ${{ matrix.platform.nodes }}
5046
container:
5147
image: ghcr.io/microsoft/ccf/ci/${{ matrix.platform.image }}:build-25-07-2024
@@ -65,15 +61,6 @@ jobs:
6561
ninja
6662
shell: bash
6763

68-
- name: "Platform SGX"
69-
run: |
70-
sudo groupadd -fg $(/usr/bin/stat -Lc '%g' /dev/sgx/provision) sgx_prv
71-
sudo usermod -a -G sgx_prv $(whoami)
72-
samples/scripts/sgxinfo.sh
73-
cat /proc/cpuinfo | grep flags | uniq
74-
shell: bash
75-
if: "${{ matrix.platform.name == 'sgx' }}"
76-
7764
- name: "Platform SNP"
7865
run: |
7966
samples/scripts/snpinfo.sh

CMakeLists.txt

Lines changed: 22 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# Licensed under the Apache 2.0 License.
33
cmake_minimum_required(VERSION 3.16)
44

5-
set(ALLOWED_TARGETS "sgx;snp;virtual")
5+
set(ALLOWED_TARGETS "snp;virtual")
66

77
set(COMPILE_TARGET
8-
"sgx"
8+
"snp"
99
CACHE STRING
1010
"Target compilation platforms, Choose from: ${ALLOWED_TARGETS}"
1111
)
@@ -76,25 +76,14 @@ endif()
7676

7777
option(
7878
VERBOSE_LOGGING
79-
"Enable verbose, potentially unsafe logging of enclave code. Affects logging level passed at run-time to end-to-end-tests, and compile-time max verbosity on SGX."
79+
"Enable verbose, potentially unsafe logging of enclave code. Affects logging level passed at run-time to end-to-end-tests."
8080
OFF
8181
)
8282
set(TEST_LOGGING_LEVEL "info")
8383
if(VERBOSE_LOGGING)
8484
set(TEST_LOGGING_LEVEL "trace")
8585
endif()
8686

87-
# NB: Toggling VERBOSE_LOGGING on non-SGX platforms causes no build change, so
88-
# should not cause a rebuild
89-
if(COMPILE_TARGET STREQUAL "sgx" AND NOT VERBOSE_LOGGING)
90-
# Disable verbose, unsafe logging of enclave code. On some platforms it is
91-
# safe to build with this logging enabled, and then it can be disabled at
92-
# run-time. However this run-time control is not possible on SGX, so to ensure
93-
# a given MRENCLAVE cannot leak via debug logging it must be removed at
94-
# build-time, with this option.
95-
add_compile_definitions(CCF_DISABLE_VERBOSE_LOGGING)
96-
endif()
97-
9887
option(USE_NULL_ENCRYPTOR "Turn off encryption of ledger updates - debug only"
9988
OFF
10089
)
@@ -134,9 +123,6 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/tools.cmake)
134123
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/tools.cmake DESTINATION cmake)
135124
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ccf_app.cmake)
136125
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ccf_app.cmake DESTINATION cmake)
137-
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/open_enclave.cmake
138-
DESTINATION cmake
139-
)
140126

141127
if(SAN AND LVI_MITIGATIONS)
142128
message(
@@ -152,18 +138,6 @@ if(TSAN AND LVI_MITIGATIONS)
152138
)
153139
endif()
154140

155-
add_custom_command(
156-
COMMAND
157-
openenclave::oeedger8r ${CCF_DIR}/edl/ccf.edl --search-path ${OE_INCLUDEDIR}
158-
--trusted --trusted-dir ${CCF_GENERATED_DIR} --untrusted --untrusted-dir
159-
${CCF_GENERATED_DIR}
160-
COMMAND mv ${CCF_GENERATED_DIR}/ccf_t.c ${CCF_GENERATED_DIR}/ccf_t.cpp
161-
COMMAND mv ${CCF_GENERATED_DIR}/ccf_u.c ${CCF_GENERATED_DIR}/ccf_u.cpp
162-
DEPENDS ${CCF_DIR}/edl/ccf.edl
163-
OUTPUT ${CCF_GENERATED_DIR}/ccf_t.cpp ${CCF_GENERATED_DIR}/ccf_u.cpp
164-
COMMENT "Generating code from EDL, and renaming to .cpp"
165-
)
166-
167141
# Copy and install CCF utilities
168142
set(CCF_UTILITIES keygenerator.sh submit_recovery_share.sh verify_quote.sh)
169143
foreach(UTILITY ${CCF_UTILITIES})
@@ -184,7 +158,6 @@ foreach(UTILITY ${CCF_TEST_UTILITIES})
184158
endforeach()
185159

186160
# Install additional utilities
187-
install(PROGRAMS ${CCF_DIR}/samples/scripts/sgxinfo.sh DESTINATION bin)
188161
install(PROGRAMS ${CCF_DIR}/samples/scripts/snpinfo.sh DESTINATION bin)
189162
install(FILES ${CCF_DIR}/tests/config.jinja DESTINATION bin)
190163

@@ -199,15 +172,7 @@ install(
199172
USE_SOURCE_PERMISSIONS
200173
)
201174

202-
if(COMPILE_TARGET STREQUAL "sgx")
203-
# While virtual libraries need to be built for sgx for unit tests, these do
204-
# not get installed to minimise installation size
205-
set(INSTALL_VIRTUAL_LIBRARIES OFF)
206-
207-
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
208-
set(DEFAULT_ENCLAVE_TYPE debug)
209-
endif()
210-
elseif(COMPILE_TARGET STREQUAL "snp")
175+
if(COMPILE_TARGET STREQUAL "snp")
211176
set(INSTALL_VIRTUAL_LIBRARIES OFF)
212177
else()
213178
set(INSTALL_VIRTUAL_LIBRARIES ON)
@@ -268,10 +233,6 @@ list(APPEND CCHOST_SOURCES ${CCF_DIR}/src/host/main.cpp
268233
${CCF_DIR}/src/host/env.cpp
269234
)
270235

271-
if(COMPILE_TARGET STREQUAL "sgx")
272-
list(APPEND CCHOST_SOURCES ${CCF_GENERATED_DIR}/ccf_u.cpp)
273-
endif()
274-
275236
add_executable(cchost ${CCHOST_SOURCES})
276237

277238
add_warning_checks(cchost)
@@ -282,9 +243,7 @@ target_compile_options(
282243
)
283244
target_include_directories(cchost PRIVATE ${CCF_GENERATED_DIR})
284245

285-
if(COMPILE_TARGET STREQUAL "sgx")
286-
target_compile_definitions(cchost PUBLIC PLATFORM_SGX)
287-
elseif(COMPILE_TARGET STREQUAL "snp")
246+
if(COMPILE_TARGET STREQUAL "snp")
288247
target_compile_definitions(cchost PUBLIC PLATFORM_SNP)
289248
elseif(COMPILE_TARGET STREQUAL "virtual")
290249
target_compile_definitions(cchost PUBLIC PLATFORM_VIRTUAL)
@@ -294,21 +253,11 @@ target_link_libraries(
294253
cchost PRIVATE uv ${TLS_LIBRARY} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}
295254
${LINK_LIBCXX} ccfcrypto.host
296255
)
297-
if(COMPILE_TARGET STREQUAL "sgx")
298-
target_link_libraries(cchost PRIVATE openenclave::oehost)
299-
endif()
300256

301257
install(TARGETS cchost DESTINATION bin)
302258

303259
# HTTP parser
304-
if(COMPILE_TARGET STREQUAL "sgx")
305-
add_enclave_library_c(http_parser.enclave "${HTTP_PARSER_SOURCES}")
306-
install(
307-
TARGETS http_parser.enclave
308-
EXPORT ccf
309-
DESTINATION lib
310-
)
311-
elseif(COMPILE_TARGET STREQUAL "snp")
260+
if(COMPILE_TARGET STREQUAL "snp")
312261
add_library(http_parser.snp "${HTTP_PARSER_SOURCES}")
313262
set_property(TARGET http_parser.snp PROPERTY POSITION_INDEPENDENT_CODE ON)
314263
install(
@@ -353,19 +302,9 @@ set(CCF_JS_SOURCES
353302
${CCF_DIR}/src/js/registry.cpp
354303
)
355304

356-
if(COMPILE_TARGET STREQUAL "sgx")
357-
add_enclave_library(ccf_js.enclave "${CCF_JS_SOURCES}")
358-
target_link_libraries(ccf_js.enclave PUBLIC ccfcrypto.enclave quickjs.enclave)
359-
# JS extension observes jwt_management.h header where this definition is
360-
# required
361-
target_compile_definitions(ccf_js.enclave PUBLIC SGX_ATTESTATION_VERIFICATION)
362-
add_warning_checks(ccf_js.enclave)
363-
install(
364-
TARGETS ccf_js.enclave
365-
EXPORT ccf
366-
DESTINATION lib
367-
)
368-
elseif(COMPILE_TARGET STREQUAL "snp")
305+
set(OE_BINDIR "")
306+
307+
if(COMPILE_TARGET STREQUAL "snp")
369308
add_host_library(ccf_js.snp "${CCF_JS_SOURCES}")
370309
add_san(ccf_js.snp)
371310
target_link_libraries(ccf_js.snp PUBLIC ccfcrypto.snp quickjs.snp)
@@ -395,15 +334,7 @@ set(CCF_KV_SOURCES
395334
${CCF_DIR}/src/kv/untyped_map_diff.cpp
396335
)
397336

398-
if(COMPILE_TARGET STREQUAL "sgx")
399-
add_enclave_library(ccf_kv.enclave "${CCF_KV_SOURCES}")
400-
add_warning_checks(ccf_kv.enclave)
401-
install(
402-
TARGETS ccf_kv.enclave
403-
EXPORT ccf
404-
DESTINATION lib
405-
)
406-
elseif(COMPILE_TARGET STREQUAL "snp")
337+
if(COMPILE_TARGET STREQUAL "snp")
407338
add_host_library(ccf_kv.snp "${CCF_KV_SOURCES}")
408339
add_san(ccf_kv.snp)
409340
add_warning_checks(ccf_kv.snp)
@@ -426,23 +357,7 @@ if(INSTALL_VIRTUAL_LIBRARIES)
426357
endif()
427358

428359
# CCF endpoints libs
429-
if(COMPILE_TARGET STREQUAL "sgx")
430-
add_enclave_library(ccf_endpoints.enclave "${CCF_ENDPOINTS_SOURCES}")
431-
target_include_directories(
432-
ccf_endpoints.enclave PRIVATE ${CCF_DIR}/src/endpoints
433-
)
434-
target_link_libraries(
435-
ccf_endpoints.enclave
436-
PUBLIC qcbor.enclave t_cose.enclave http_parser.enclave ccfcrypto.enclave
437-
ccf_kv.enclave
438-
)
439-
add_warning_checks(ccf_endpoints.enclave)
440-
install(
441-
TARGETS ccf_endpoints.enclave
442-
EXPORT ccf
443-
DESTINATION lib
444-
)
445-
elseif(COMPILE_TARGET STREQUAL "snp")
360+
if(COMPILE_TARGET STREQUAL "snp")
446361
add_host_library(ccf_endpoints.snp "${CCF_ENDPOINTS_SOURCES}")
447362
target_include_directories(ccf_endpoints.snp PRIVATE ${CCF_DIR}/src/endpoints)
448363
target_link_libraries(
@@ -497,16 +412,7 @@ set(CCF_NETWORK_TEST_ARGS
497412
)
498413

499414
set(JS_GENERIC_SOURCES ${CCF_DIR}/src/apps/js_generic/js_generic_base.cpp)
500-
if(COMPILE_TARGET STREQUAL "sgx")
501-
add_enclave_library(js_generic_base.enclave ${JS_GENERIC_SOURCES})
502-
target_link_libraries(js_generic_base.enclave PUBLIC ccf.enclave)
503-
add_lvi_mitigations(js_generic_base.enclave)
504-
install(
505-
TARGETS js_generic_base.enclave
506-
EXPORT ccf
507-
DESTINATION lib
508-
)
509-
elseif(COMPILE_TARGET STREQUAL "snp")
415+
if(COMPILE_TARGET STREQUAL "snp")
510416
add_library(js_generic_base.snp STATIC ${JS_GENERIC_SOURCES})
511417
add_san(js_generic_base.snp)
512418
add_warning_checks(js_generic_base.snp)
@@ -545,10 +451,6 @@ add_ccf_app(
545451
LINK_LIBS_VIRTUAL js_generic_base.virtual
546452
LINK_LIBS_SNP js_generic_base.snp INSTALL_LIBS ON
547453
)
548-
sign_app_library(
549-
js_generic.enclave ${CCF_DIR}/src/apps/js_generic/oe_sign.conf
550-
${CMAKE_CURRENT_BINARY_DIR}/signing_key.pem INSTALL_LIBS ON
551-
)
552454
# SNIPPET_END: JS generic application
553455

554456
install(DIRECTORY ${CCF_DIR}/samples/apps/logging/js
@@ -632,54 +534,8 @@ set(CCF_IMPL_SOURCE
632534
${CCF_DIR}/src/enclave/thread_local.cpp ${CCF_DIR}/src/node/quote.cpp
633535
)
634536

635-
if(COMPILE_TARGET STREQUAL "sgx")
636-
# enclave version
637-
add_enclave_library(
638-
ccf.enclave ${CCF_IMPL_SOURCE} ${CCF_GENERATED_DIR}/ccf_t.cpp
639-
)
640-
641-
# PLATFORM_SGX to initialise Open Enclave SGX enclave creation and
642-
# SGX_ATTESTATION_VERIFICATION to verify SGX attestation reports.
643-
target_compile_definitions(
644-
ccf.enclave PUBLIC PLATFORM_SGX SGX_ATTESTATION_VERIFICATION
645-
)
646-
647-
add_warning_checks(ccf.enclave)
648-
649-
target_include_directories(
650-
ccf.enclave SYSTEM
651-
PUBLIC
652-
$<BUILD_INTERFACE:${CCF_GENERATED_DIR}>
653-
$<INSTALL_INTERFACE:include/ccf/> #< This contains the private headers
654-
#< which are currently under src, and
655-
#< should be removed or renamed
656-
$<INSTALL_INTERFACE:include/>
657-
$<INSTALL_INTERFACE:include/3rdparty/>
658-
)
659-
660-
target_link_libraries(
661-
ccf.enclave
662-
PUBLIC http_parser.enclave
663-
sss.enclave
664-
ccf_js.enclave
665-
ccf_endpoints.enclave
666-
ccfcrypto.enclave
667-
ccf_kv.enclave
668-
nghttp2.enclave
669-
)
670-
671-
add_lvi_mitigations(ccf.enclave)
672-
673-
install(
674-
TARGETS ccf.enclave
675-
EXPORT ccf
676-
DESTINATION lib
677-
)
678-
679-
add_dependencies(ccf ccf.enclave)
680-
681-
# Same as virtual for the time being but will diverge soon
682-
elseif(COMPILE_TARGET STREQUAL "snp")
537+
# Same as virtual for the time being but will diverge soon
538+
if(COMPILE_TARGET STREQUAL "snp")
683539

684540
# SNP version
685541
add_library(ccf.snp STATIC ${CCF_IMPL_SOURCE})
@@ -831,16 +687,6 @@ install(FILES samples/constitutions/default/apply.js DESTINATION bin)
831687
install(FILES tests/start_network.py DESTINATION bin)
832688
install(FILES tests/requirements.txt DESTINATION bin)
833689

834-
# Generate an ephemeral signing key
835-
add_custom_command(
836-
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/signing_key.pem
837-
COMMAND openssl genrsa -out ${CMAKE_CURRENT_BINARY_DIR}/signing_key.pem -3
838-
3072
839-
)
840-
add_custom_target(
841-
signing_key ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/signing_key.pem
842-
)
843-
844690
# Add sample apps
845691
add_subdirectory(${CCF_DIR}/samples)
846692

@@ -1134,17 +980,14 @@ if(BUILD_TESTS)
1134980
PROPERTY ENVIRONMENT "ASAN_OPTIONS=alloc_dealloc_mismatch=0"
1135981
)
1136982

1137-
if(NOT UNSAFE_VERSION)
1138-
# Unsafe builds do not follow normal version conventions
1139-
add_test(NAME versionifier_test
1140-
COMMAND ${PYTHON}
1141-
${CMAKE_SOURCE_DIR}/python/src/ccf/_versionifier.py
1142-
)
983+
add_test(NAME versionifier_test
984+
COMMAND ${PYTHON}
985+
${CMAKE_SOURCE_DIR}/python/src/ccf/_versionifier.py
986+
)
1143987

1144-
add_test(NAME github_version_lts_test
1145-
COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/tests/infra/github.py
1146-
)
1147-
endif()
988+
add_test(NAME github_version_lts_test
989+
COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/tests/infra/github.py
990+
)
1148991
endif()
1149992

1150993
if(NOT TSAN)
@@ -1463,9 +1306,7 @@ if(BUILD_TESTS)
14631306
list(APPEND LTS_TEST_ARGS --check-ledger-compatibility)
14641307
endif()
14651308

1466-
if(NOT UNSAFE_VERSION AND NOT SAN)
1467-
# Unsafe builds do not follow normal version conventions LTS nodes may
1468-
# also require different runtime libraries
1309+
if(NOT SAN)
14691310
add_e2e_test(
14701311
NAME lts_compatibility
14711312
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/lts_compatibility.py

0 commit comments

Comments
 (0)