openenclave / oeedger8r-cpp

An implementation of oeedger8r in C++
MIT License
8 stars 13 forks source link

Enclave is in simulation mode when oe_get_create_flags returns 0 #38

Closed yanxue-intel closed 4 years ago

yanxue-intel commented 4 years ago

The flag does not work in oeedger8r-cpp's test.

How to set enclave in hardware mode?

anakrish commented 4 years ago

@yanxue-intel For hardware-mode tests, it is better to use https://github.com/openenclave/openenclave repository.

yanxue-intel commented 4 years ago

OK, thanks. I saw that oeedger-cpp has been merged into openenclave repository. The oeedger's new cases will add to the openenclave repository, right?

anakrish commented 4 years ago

oeedger8r-cpp is added as a submodule of openenclave and we also run the tests from the submodule as part of the Open Enclave SDK build process. So any test that is added to this repository will also be run there. Any hardware specific tests or security oriented tests are best added to the Open Enclave repository rather than here. We can also duplicate tests as needed.

https://github.com/openenclave/openenclave/blob/1121bc9d2dda0f6c89c5511c639444868cde3849/tools/CMakeLists.txt#L17-L25

ExternalProject_Add(
  oeedger8r-cpp
  SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/oeedger8r-cpp
  BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/oeedger8r-cpp
  CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
  BUILD_ALWAYS on
  TEST_BEFORE_INSTALL on    <---- this ensures that the tests are run in OpenEnclave repository
  INSTALL_COMMAND ""
  BUILD_BYPRODUCTS ${BINARY})
yanxue-intel commented 4 years ago

got it, Thanks @anakrish

anakrish commented 4 years ago

To summarize:

oeedger8r-cpp repository allows development/testing of oeedger8r outside of SGX hardware. This is important since oeedger8r also generates code for OPTEE enclaves. It tests runtime behavior of generated code by loading enclaves in a "virtual" mode which is akin to simulation mode in OE. Though the virtual mode has been made to look as much as possible like the OE public API surface, not all APIs have the same behavior since SGX hardware does not exist for oeedger8r-cpp repo (by design).

The strategy for oeedger8r testing is