Git Product home page Git Product logo

sgx-cmake's Introduction

SGX-CMake

CMake file for compiling with Intel SGX.

To make compiling code using SGX with CMake easier, a single FindSGX.cmake file is provided for the purpose.

This code example is from official Intel SGX sample Cxx11SGXDemo.

Please refer to the CMakeLists.txt file for how to use FindSGX.cmake file.

How to use

list(APPEND CMAKE_MODULE_PATH ${PATH_TO_FindSGX.cmake_FILE})
find_package(SGX REQUIRED)

The following variables are provided:

  • SGX_HW # ON for hardware, OFF for simulation.
  • SGX_MODE # Debug; PreRelease; Release.
  • SGX_INCLUDE_DIR
  • SGX_TLIBC_INCLUDE_DIR
  • SGX_LIBCXX_INCLUDE_DIR
  • SGX_INCLUDE_DIRS # all 3 dirs above
  • SGX_LIBRARY_DIR

The following functions are provided:

# build enclave library
add_enclave_library(target
                    [USE_PREFIX]
                    [USE_SGXSSL]
                    SRCS src_file1 src_file2 ...
                    EDL edl_file
                    EDL_SEARCH_PATHS path1 path2 ...
                    [TRUSTED_LIBS lib1 lib2 ...]
                    [LDSCRIPT ld_script_file])

# build trusted static library to be linked into enclave library
add_trusted_library(target
                    [USE_PREFIX]
                    [USE_SGXSSL]
                    SRCS src_file1 src_file2 ...
                    EDL edl_file
                    EDL_SEARCH_PATHS path1 path2 ...
                    [LDSCRIPT ld_script_file])

# sign the enclave, according to configurations one-step or two-step signing will be performed.
# default one-step signing output enclave name is target.signed.so, change it with OUTPUT option.
enclave_sign(target
             KEY key
	     [IGNORE_INIT]
	     [IGNORE_REL]
             [CONFIG config]
             [OUTPUT file_name])

# build untrusted executable to run with enclave
add_untrusted_executable(target
                         [USE_PREFIX]
                         SRCS src1 src2 ...
                         EDL edl_file1 edl_file2 ...
                         EDL_SEARCH_PATHS path1 path2 ...)

# build untrusted library to be run with enclave
add_untrusted_library(target
                      STATIC | SHARED | MODULE
                      [USE_PREFIX]
                      SRCS src1 src2 ...
                      EDL edl_file1 edl_file2 ...
                      EDL_SEARCH_PATHS path1 path2 ...)

ROS

A ROS package sgx_cmake is provided for using inside ROS.

To use it, clone the repo to catkin_ws/src, and in the projects which need to use it:

# add in package.xml
<build_depend>sgx_cmake</build_depend>

# add in CMakeLists.txt
find_package(catkin REQUIRED COMPONENTS sgx_cmake)
find_package(SGX)

sgx-cmake's People

Contributors

athrunarthur avatar dymil avatar ffosilva avatar name1e5s avatar tinoryj avatar xzhangxa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.