Skip to content

Commit

Permalink
Remove open-enclave-hostverify dependency in virtual and snp builds (m…
Browse files Browse the repository at this point in the history
…icrosoft#6423)

Co-authored-by: Max Tropets <[email protected]>
Co-authored-by: Max <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2024
1 parent 5ad32d2 commit 20965eb
Show file tree
Hide file tree
Showing 13 changed files with 6 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
set -ex
mkdir build
cd build
cmake -DCOMPILE_TARGET=virtual -DREQUIRE_OPENENCLAVE=OFF -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=OFF -DLVI_MITIGATIONS=OFF ..
cmake -DCOMPILE_TARGET=virtual -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=OFF -DLVI_MITIGATIONS=OFF ..
name: Run CMake
- run: |
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,6 @@ elseif(COMPILE_TARGET STREQUAL "snp")
nghttp2.snp
${CMAKE_THREAD_LIBS_INIT}
)
link_openenclave_host(ccf.snp)

set_property(TARGET ccf.snp PROPERTY POSITION_INDEPENDENT_CODE ON)

Expand Down Expand Up @@ -767,7 +766,6 @@ elseif(COMPILE_TARGET STREQUAL "virtual")
nghttp2.host
${CMAKE_THREAD_LIBS_INIT}
)
link_openenclave_host(ccf.virtual)

set_property(TARGET ccf.virtual PROPERTY POSITION_INDEPENDENT_CODE ON)

Expand Down
1 change: 0 additions & 1 deletion cmake/ccf_app.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,5 @@ function(add_host_library name)
add_library(${name} ${files})
target_compile_options(${name} PUBLIC ${COMPILE_LIBCXX})
target_link_libraries(${name} PUBLIC ${LINK_LIBCXX} -lgcc)
link_openenclave_host(${name})
set_property(TARGET ${name} PROPERTY POSITION_INDEPENDENT_CODE ON)
endfunction()
1 change: 0 additions & 1 deletion cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function(add_unit_test name)
)
enable_coverage(${name})
target_link_libraries(${name} PRIVATE ${LINK_LIBCXX} ccfcrypto.host -pthread)
link_openenclave_host(${name})
add_san(${name})

add_test(NAME ${name} COMMAND ${name})
Expand Down
6 changes: 1 addition & 5 deletions cmake/cpack_settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ if(COMPILE_TARGET STREQUAL "sgx")
"libc++1-11;libc++abi1-11;open-enclave (>=${OE_VERSION})"
)
else()
list(
APPEND
CCF_DEB_DEPENDENCIES
"libc++1-15;libc++abi1-15;open-enclave-hostverify (>=${OE_VERSION}) | open-enclave (>=${OE_VERSION})"
)
list(APPEND CCF_DEB_DEPENDENCIES "libc++1-15;libc++abi1-15")
endif()

list(JOIN CCF_DEB_DEPENDENCIES ", " CPACK_DEBIAN_PACKAGE_DEPENDS)
Expand Down
23 changes: 1 addition & 22 deletions cmake/open_enclave.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.

# We allow for Open Enclave (and Open Enclave HostVerify) to _not_ be installed,
# with some limitations (e.g. virtual/snp builds cannot verify sgx attestation
# reports). This can hopefully be removed by 5.x (see
# https://github.com/microsoft/CCF/issues/5291).
option(REQUIRE_OPENENCLAVE "Requires Open Enclave or HostVerify variant" ON)

if(REQUIRE_OPENENCLAVE)
if(NOT COMPILE_TARGET STREQUAL "sgx")
set(COMPONENT "OEHOSTVERIFY")
endif()

if(COMPILE_TARGET STREQUAL "sgx")
# Find OpenEnclave package
find_package(OpenEnclave 0.19.7 CONFIG REQUIRED)

Expand Down Expand Up @@ -52,16 +42,5 @@ if(REQUIRE_OPENENCLAVE)
endfunction()

set(OE_HOST_LIBRARY openenclave::oehost)
else()
set(OE_HOST_LIBRARY openenclave::oehostverify)
endif()
elseif(COMPILE_TARGET STREQUAL "sgx")
message(FATAL_ERROR "Open Enclave is required for SGX target")
endif()

function(link_openenclave_host name)
if(REQUIRE_OPENENCLAVE)
target_link_libraries(${name} PUBLIC ${OE_HOST_LIBRARY})
target_compile_definitions(${name} PUBLIC SGX_ATTESTATION_VERIFICATION)
endif()
endfunction()
13 changes: 1 addition & 12 deletions getting_started/setup_vm/app-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,10 @@
- import_role:
name: az_dcap
tasks_from: install.yml

# If OE is already installed, we don't want to install hostverify as they are mutually
# exclusive. Non-SGX CCF builds can use either of them.
- name: Gather the package facts
ansible.builtin.package_facts:
manager: auto
- import_role:
name: openenclave
tasks_from: binary_install.yml
when: (platform == "sgx") or ("open-enclave" in ansible_facts.packages)
- import_role:
name: openenclave
tasks_from: install_host_verify.yml
when: (platform != "sgx") and ("open-enclave" not in ansible_facts.packages)

when: platform == "sgx"
- import_role:
name: ccf_build
tasks_from: install.yml
Expand Down
4 changes: 0 additions & 4 deletions getting_started/setup_vm/app-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
name: openenclave
tasks_from: binary_install.yml
when: platform == "sgx"
- import_role:
name: openenclave
tasks_from: install_host_verify.yml
when: platform != "sgx"
- import_role:
name: ccf_install
tasks_from: deb_install.yml
Expand Down
7 changes: 1 addition & 6 deletions getting_started/setup_vm/ccf-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
vars:
platform: "sgx"
clang_version: "11"
require_open_enclave: true
tasks:
- import_role:
name: llvm_repo
Expand All @@ -19,15 +18,11 @@
- import_role:
name: az_dcap
tasks_from: install.yml
when: require_open_enclave
when: platform == "sgx"
- import_role:
name: openenclave
tasks_from: binary_install.yml
when: platform == "sgx"
- import_role:
name: openenclave
tasks_from: install_host_verify.yml
when: platform != "sgx" and require_open_enclave
- import_role:
name: nodejs
tasks_from: install.yml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
- name: Include vars
include_vars: common.yml

- name: Uninstall Open Enclave Host Verify
apt:
name: open-enclave-hostverify
state: absent
become: yes

- name: Install Open Enclave
apt:
deb: "{{ oe_deb }}"
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion getting_started/setup_vm/roles/openenclave/vars/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ oe_build_opts: "-DLVI_MITIGATION=ControlFlow-GNU"

# Binary install
oe_deb: "https://github.com/openenclave/openenclave/releases/download/v{{ oe_ver }}/Ubuntu_2004_open-enclave_{{ oe_ver_ }}_amd64.deb"
oe_host_verify_deb: "https://github.com/openenclave/openenclave/releases/download/v{{ oe_ver }}/Ubuntu_2004_open-enclave-hostverify_{{ oe_ver_ }}_amd64.deb"
1 change: 1 addition & 0 deletions tests/infra/e2e_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def cli_args(
"--oe-binary",
help="Path to Open Enclave binary folder",
type=str,
nargs="?",
default="/opt/openenclave/bin/",
)
parser.add_argument(
Expand Down

0 comments on commit 20965eb

Please sign in to comment.