2
2
# Licensed under the Apache 2.0 License.
3
3
cmake_minimum_required (VERSION 3.16)
4
4
5
- set (ALLOWED_TARGETS "sgx; snp;virtual" )
5
+ set (ALLOWED_TARGETS "snp;virtual" )
6
6
7
7
set (COMPILE_TARGET
8
- "sgx "
8
+ "snp "
9
9
CACHE STRING
10
10
"Target compilation platforms, Choose from: ${ALLOWED_TARGETS} "
11
11
)
@@ -76,25 +76,14 @@ endif()
76
76
77
77
option (
78
78
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."
80
80
OFF
81
81
)
82
82
set (TEST_LOGGING_LEVEL "info" )
83
83
if (VERBOSE_LOGGING)
84
84
set (TEST_LOGGING_LEVEL "trace" )
85
85
endif ()
86
86
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
-
98
87
option (USE_NULL_ENCRYPTOR "Turn off encryption of ledger updates - debug only"
99
88
OFF
100
89
)
@@ -134,9 +123,6 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/tools.cmake)
134
123
install (FILES ${CMAKE_CURRENT_SOURCE_DIR} /cmake/tools.cmake DESTINATION cmake)
135
124
include (${CMAKE_CURRENT_SOURCE_DIR} /cmake/ccf_app.cmake)
136
125
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
- )
140
126
141
127
if (SAN AND LVI_MITIGATIONS)
142
128
message (
@@ -152,18 +138,6 @@ if(TSAN AND LVI_MITIGATIONS)
152
138
)
153
139
endif ()
154
140
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
-
167
141
# Copy and install CCF utilities
168
142
set (CCF_UTILITIES keygenerator.sh submit_recovery_share.sh verify_quote.sh)
169
143
foreach (UTILITY ${CCF_UTILITIES} )
@@ -184,7 +158,6 @@ foreach(UTILITY ${CCF_TEST_UTILITIES})
184
158
endforeach ()
185
159
186
160
# Install additional utilities
187
- install (PROGRAMS ${CCF_DIR} /samples/scripts/sgxinfo.sh DESTINATION bin)
188
161
install (PROGRAMS ${CCF_DIR} /samples/scripts/snpinfo.sh DESTINATION bin)
189
162
install (FILES ${CCF_DIR} /tests/config.jinja DESTINATION bin)
190
163
@@ -199,15 +172,7 @@ install(
199
172
USE_SOURCE_PERMISSIONS
200
173
)
201
174
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" )
211
176
set (INSTALL_VIRTUAL_LIBRARIES OFF )
212
177
else ()
213
178
set (INSTALL_VIRTUAL_LIBRARIES ON )
@@ -268,10 +233,6 @@ list(APPEND CCHOST_SOURCES ${CCF_DIR}/src/host/main.cpp
268
233
${CCF_DIR} /src/host/env.cpp
269
234
)
270
235
271
- if (COMPILE_TARGET STREQUAL "sgx" )
272
- list (APPEND CCHOST_SOURCES ${CCF_GENERATED_DIR} /ccf_u.cpp)
273
- endif ()
274
-
275
236
add_executable (cchost ${CCHOST_SOURCES} )
276
237
277
238
add_warning_checks(cchost)
@@ -282,9 +243,7 @@ target_compile_options(
282
243
)
283
244
target_include_directories (cchost PRIVATE ${CCF_GENERATED_DIR} )
284
245
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" )
288
247
target_compile_definitions (cchost PUBLIC PLATFORM_SNP)
289
248
elseif (COMPILE_TARGET STREQUAL "virtual" )
290
249
target_compile_definitions (cchost PUBLIC PLATFORM_VIRTUAL)
@@ -294,21 +253,11 @@ target_link_libraries(
294
253
cchost PRIVATE uv ${TLS_LIBRARY} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}
295
254
${LINK_LIBCXX} ccfcrypto.host
296
255
)
297
- if (COMPILE_TARGET STREQUAL "sgx" )
298
- target_link_libraries (cchost PRIVATE openenclave::oehost)
299
- endif ()
300
256
301
257
install (TARGETS cchost DESTINATION bin)
302
258
303
259
# 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" )
312
261
add_library (http_parser.snp "${HTTP_PARSER_SOURCES} " )
313
262
set_property (TARGET http_parser.snp PROPERTY POSITION_INDEPENDENT_CODE ON )
314
263
install (
@@ -353,19 +302,9 @@ set(CCF_JS_SOURCES
353
302
${CCF_DIR} /src/js/registry.cpp
354
303
)
355
304
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" )
369
308
add_host_library(ccf_js.snp "${CCF_JS_SOURCES} " )
370
309
add_san(ccf_js.snp)
371
310
target_link_libraries (ccf_js.snp PUBLIC ccfcrypto.snp quickjs.snp)
@@ -395,15 +334,7 @@ set(CCF_KV_SOURCES
395
334
${CCF_DIR} /src/kv/untyped_map_diff.cpp
396
335
)
397
336
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" )
407
338
add_host_library(ccf_kv.snp "${CCF_KV_SOURCES} " )
408
339
add_san(ccf_kv.snp)
409
340
add_warning_checks(ccf_kv.snp)
@@ -426,23 +357,7 @@ if(INSTALL_VIRTUAL_LIBRARIES)
426
357
endif ()
427
358
428
359
# 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" )
446
361
add_host_library(ccf_endpoints.snp "${CCF_ENDPOINTS_SOURCES} " )
447
362
target_include_directories (ccf_endpoints.snp PRIVATE ${CCF_DIR} /src/endpoints)
448
363
target_link_libraries (
@@ -497,16 +412,7 @@ set(CCF_NETWORK_TEST_ARGS
497
412
)
498
413
499
414
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" )
510
416
add_library (js_generic_base.snp STATIC ${JS_GENERIC_SOURCES} )
511
417
add_san(js_generic_base.snp)
512
418
add_warning_checks(js_generic_base.snp)
@@ -545,10 +451,6 @@ add_ccf_app(
545
451
LINK_LIBS_VIRTUAL js_generic_base.virtual
546
452
LINK_LIBS_SNP js_generic_base.snp INSTALL_LIBS ON
547
453
)
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
- )
552
454
# SNIPPET_END: JS generic application
553
455
554
456
install (DIRECTORY ${CCF_DIR} /samples/apps/logging/js
@@ -632,54 +534,8 @@ set(CCF_IMPL_SOURCE
632
534
${CCF_DIR} /src/enclave/thread_local.cpp ${CCF_DIR} /src/node/quote.cpp
633
535
)
634
536
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" )
683
539
684
540
# SNP version
685
541
add_library (ccf.snp STATIC ${CCF_IMPL_SOURCE} )
@@ -831,16 +687,6 @@ install(FILES samples/constitutions/default/apply.js DESTINATION bin)
831
687
install (FILES tests/start_network.py DESTINATION bin)
832
688
install (FILES tests/requirements.txt DESTINATION bin)
833
689
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
-
844
690
# Add sample apps
845
691
add_subdirectory (${CCF_DIR} /samples)
846
692
@@ -1134,17 +980,14 @@ if(BUILD_TESTS)
1134
980
PROPERTY ENVIRONMENT "ASAN_OPTIONS=alloc_dealloc_mismatch=0"
1135
981
)
1136
982
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
+ )
1143
987
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
+ )
1148
991
endif ()
1149
992
1150
993
if (NOT TSAN)
@@ -1463,9 +1306,7 @@ if(BUILD_TESTS)
1463
1306
list (APPEND LTS_TEST_ARGS --check-ledger-compatibility)
1464
1307
endif ()
1465
1308
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)
1469
1310
add_e2e_test(
1470
1311
NAME lts_compatibility
1471
1312
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR} /tests/lts_compatibility.py
0 commit comments