Skip to content

Commit

Permalink
Add flag (emp-toolkit#150)
Browse files Browse the repository at this point in the history
* address issue emp-toolkit#148

* add flag
  • Loading branch information
wangxiao1254 authored Jan 14, 2022
1 parent b028915 commit cc6c93c
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 35 deletions.
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ cmake_minimum_required (VERSION 3.0)
project (emptool)
set(NAME "emp-tool")

set(CMAKE_FOLDER ./)
include(${CMAKE_FOLDER}/cmake/emp-base.cmake)

IF(${CRYPTO_IN_CIRCUIT})
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_SOURCE_DIR}/emp-tool/circuits/files/bristol_fashion/Keccak_f.txt.cpp
COMMAND xxd -i emp-tool/circuits/files/bristol_fashion/Keccak_f.txt emp-tool/circuits/files/bristol_fashion/Keccak_f.txt.hex
Expand All @@ -17,11 +21,10 @@ ADD_CUSTOM_COMMAND(
COMMAND cat emp-tool/circuits/files/bristol_fashion/aes_128.txt.hex >> emp-tool/circuits/files/bristol_fashion/aes_128.txt.cpp
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Compiling aes_128 circuit file to binary")
ENDIF(${CRYPTO_IN_CIRCUIT})

set(sources
emp-tool/emp-tool.cpp
emp-tool/circuits/files/bristol_fashion/aes_128.txt.cpp
emp-tool/circuits/files/bristol_fashion/Keccak_f.txt.cpp
emp-tool/circuits/float32_add.cpp
emp-tool/circuits/float32_cos.cpp
emp-tool/circuits/float32_div.cpp
Expand All @@ -39,8 +42,15 @@ emp-tool/circuits/float32_ln.cpp
emp-tool/circuits/float32_log2.cpp
)

set(CMAKE_FOLDER ./)
include(${CMAKE_FOLDER}/cmake/emp-base.cmake)
IF(${CRYPTO_IN_CIRCUIT})
set(sources
${sources}
emp-tool/circuits/files/bristol_fashion/aes_128.txt.cpp
emp-tool/circuits/files/bristol_fashion/Keccak_f.txt.cpp
)
ENDIF(${CRYPTO_IN_CIRCUIT})



find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})
Expand Down
1 change: 1 addition & 0 deletions cmake/emp-base.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ message(STATUS "CXX Flags: ${CMAKE_CXX_FLAGS}")
endif()

include(${CMAKE_FOLDER}/cmake/enable_rdseed.cmake)
include(${CMAKE_FOLDER}/cmake/enable_crypto_circuit.cmake)
include(${CMAKE_FOLDER}/cmake/enable_threading.cmake)
6 changes: 6 additions & 0 deletions cmake/enable_crypto_circuit.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
OPTION(CRYPTO_IN_CIRCUIT "Enable computing various crypto operations in circuit" OFF)
IF(${CRYPTO_IN_CIRCUIT})
ADD_DEFINITIONS(-DCRYPTO_IN_CIRCUIT)
message("Crypto in Circuit: on")
ENDIF(${CRYPTO_IN_CIRCUIT})

26 changes: 0 additions & 26 deletions cmake/enable_float.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion cmake/enable_rdseed.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OPTION(USE_RANDOM_DEVICE "Option description" OFF)
OPTION(USE_RANDOM_DEVICE "Enable RDSEED instruction" OFF)

include(CheckCSourceRuns)

Expand Down
2 changes: 1 addition & 1 deletion cmake/enable_threading.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OPTION(THREADING "Option description" OFF)
OPTION(THREADING "Enable multi-threaded backend" OFF)
IF(THREADING)
ADD_DEFINITIONS(-DTHREADING)
message("Multi Threading: on")
Expand Down
7 changes: 4 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ add_test_case_with_run(netio2)
add_test_case(bit)
add_test_case(ecc)
add_test_case(int)
IF(${ENABLE_FLOAT})
add_test_case(float)
ENDIF(${ENABLE_FLOAT})
add_test_case_with_run(garble)
add_test_case(gen_circuit)
add_test_case(mitccrh)
add_test_case(f2k)
add_test_case(halfgate)
add_test_case(to_bool)
add_test_case(aes_opt)

IF(${CRYPTO_IN_CIRCUIT})
add_test_case(sha3_256)
add_test_case(aes_128_ctr)
add_test_case(aes_opt)
ENDIF(${CRYPTO_IN_CIRCUIT})

0 comments on commit cc6c93c

Please sign in to comment.