Skip to content

Commit

Permalink
openenclave: added set_rng and example to enclave
Browse files Browse the repository at this point in the history
cmake: added openenclave config option
config: added openenclave config option
random: added set_rng for openenclave
ci: added openenclave option and U_FORTIFY_SOURCE flag
  • Loading branch information
edtubbs committed Sep 23, 2023
1 parent 57e282b commit 8d649c2
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
run-tests: true
packages: python3-dev python3-dbg python
dep-opts: "DEBUG=1 SPEED=slow V=1"
config-opts: "--enable-debug CFLAGS=-U_FORTIFY_SOURCE"
config-opts: "--enable-debug --enable-openenclave CFLAGS=-U_FORTIFY_SOURCE"
goal: install
- name: x86_64-macos
host: x86_64-apple-darwin15
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ SET(WITH_UNISTRING TRUE CACHE BOOL "enable unistring functions")
SET(WITH_WALLET TRUE CACHE BOOL "enable wallet")
SET(USE_SSE2 FALSE CACHE BOOL "enable scrypt sse2")
SET(USE_TPM2 FALSE CACHE BOOL "enable tpm_tests")
SET(USE_OPENENCLAVE FALSE CACHE BOOL "enable openenclave")
SET(RANDOM_DEVICE "/dev/urandom" CACHE STRING "set the device to read random data from")

# Set a default build type if none was specified
Expand Down Expand Up @@ -106,6 +107,9 @@ ENDIF()
IF(USE_TPM2)
ADD_DEFINITIONS(-DUSE_TPM2=1)
ENDIF()
IF(USE_OPENENCLAVE)
ADD_DEFINITIONS(-DUSE_OPENENCLAVE=1)
ENDIF()

MESSAGE(STATUS "")
MESSAGE(STATUS "Options used to compile and link:")
Expand All @@ -119,6 +123,8 @@ MESSAGE(STATUS "")
MESSAGE(STATUS " USE_SSE2 = ${USE_SSE2}")
MESSAGE(STATUS " USE_TPM2 = ${USE_TPM2}")
MESSAGE(STATUS "")
MESSAGE(STATUS " openenclave = ${USE_OPENENCLAVE}")
MESSAGE(STATUS "")
message(STATUS " library type = ${library_type}")
MESSAGE(STATUS "")

Expand Down
19 changes: 16 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ build_windows=no
CFLAGS="$CFLAGS -W"
case $host in
*mingw*)
build_windows=yes
build_windows=yes
TARGET_OS=windows
AC_CHECK_LIB([pthread], [main],, AC_MSG_ERROR(lib missing))
AC_CHECK_LIB([winpthread], [main],, AC_MSG_ERROR(lib missing))
Expand Down Expand Up @@ -128,6 +128,12 @@ AC_ARG_ENABLE([unistring],
[with_unistring=$enableval],
[with_unistring=yes])

AC_ARG_ENABLE([openenclave],
[AS_HELP_STRING([--enable-openenclave],
[Build with openenclave (default is no)])],
[use_openenclave=$enableval],
[use_openenclave=no])

AC_ARG_ENABLE(tests,
AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]),
[use_tests=$enableval],
Expand Down Expand Up @@ -195,6 +201,10 @@ if test "x$with_unistring" = xyes; then
AC_DEFINE(USE_UNISTRING, 1, [Define this symbol if libunistring works])
fi

if test "x$use_openenclave" = xyes; then
AC_DEFINE(USE_OPENENCLAVE, 1, [Define this symbol if openenclave works])
fi

AC_CONFIG_HEADERS([config/libdogecoin-config.h])
AC_CONFIG_FILES([Makefile libdogecoin.pc])
AC_SUBST(LIBTOOL_APP_LDFLAGS)
Expand All @@ -208,6 +218,7 @@ AM_CONDITIONAL([WITH_NET], [test "x$with_net" = "xyes"])
AM_CONDITIONAL([WITH_LOGDB], [test "x$with_logdb" = "xyes"])
AM_CONDITIONAL([WITH_WALLET], [test "x$with_wallet" = "xyes"])
AM_CONDITIONAL([USE_SSE2], [test "x$use_scrypt_sse2" = "xyes"])
AM_CONDITIONAL([USE_OPENENCLAVE], [test "x$use_openenclave" = "xyes"])
AC_SUBST(LIB_VERSION_CURRENT, _LIB_VERSION_CURRENT)
AC_SUBST(LIB_VERSION_REVISION, _LIB_VERSION_REVISION)
AC_SUBST(LIB_VERSION_AGE, _LIB_VERSION_AGE)
Expand All @@ -217,7 +228,7 @@ AC_CONFIG_SUBDIRS([src/secp256k1])

AC_OUTPUT

echo
echo
echo "Options used to compile and link:"
echo " with tests = $use_tests"
echo " with tools = $with_tools"
Expand All @@ -228,6 +239,8 @@ echo " with unistring = $with_unistring"
echo
echo " SSE2 Scrypt = $use_scrypt_sse2"
echo
echo " openenclave = $use_openenclave"
echo
echo " host = $host"
echo " target os = $TARGET_OS"
echo
Expand All @@ -236,4 +249,4 @@ echo " CFLAGS = $CFLAGS"
echo " CXX = $CXX"
echo " CXXFLAGS = $CXXFLAGS"
echo " LDFLAGS = $LDFLAGS"
echo
echo
Loading

0 comments on commit 8d649c2

Please sign in to comment.