diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4608d984..4e9ddc2a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,7 +57,7 @@ jobs: export CXX=g++-11 export TARGET=all mkdir -p build && cd build - cmake .. + cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo - name: Build run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 04650263..a5886c7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,16 +164,16 @@ else() set( BOOST_LIBS_4_BLS boost_program_options ) endif() -set (WITH_PROCPS OFF) +set(WITH_PROCPS OFF) set(BLS_INCLUDE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/bls - ${DEPS_SOURCES_ROOT} - ${DEPS_INSTALL_ROOT} - ${CMAKE_CURRENT_SOURCE_DIR}/deps/include - PARENT_SCOPE - ) + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/bls + ${DEPS_SOURCES_ROOT} + ${DEPS_INSTALL_ROOT} + ${CMAKE_CURRENT_SOURCE_DIR}/deps/include + PARENT_SCOPE +) target_include_directories(bls PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(bls PRIVATE ff ${CRYPTOPP_LIBRARY} ${GMPXX_LIBRARY} ${GMP_LIBRARY}) @@ -245,7 +245,9 @@ if(BUILD_TESTS) if (EMSCRIPTEN) target_compile_options(bls_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1) set_target_properties(bls_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1") - endif() + else() + target_compile_options(bls_unit_test PRIVATE -Wno-format-overflow) + endif() target_link_libraries(bls_unit_test PRIVATE bls ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY} ${BOOST_LIBS_4_BLS}) add_test(NAME bls_tests COMMAND bls_unit_test) @@ -255,7 +257,9 @@ if(BUILD_TESTS) if (EMSCRIPTEN) target_compile_options(dkg_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1) set_target_properties(dkg_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1") - endif() + else() + target_compile_options(dkg_unit_test PRIVATE -Wno-format-overflow) + endif() target_link_libraries(dkg_unit_test PRIVATE bls ${CRYPTOPP_LIBRARY} ff ${GMP_LIBRARY} ${GMPXX_LIBRARY} ${BOOST_LIBS_4_BLS}) add_test(NAME dkg_tests COMMAND dkg_unit_test) @@ -265,7 +269,9 @@ if(BUILD_TESTS) if (EMSCRIPTEN) target_compile_options(bls_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1) set_target_properties(bls_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1") - endif() + else() + target_compile_options(bls_test PRIVATE -Wno-format-overflow) + endif() target_link_libraries(bls_test PRIVATE bls ${CRYPTOPP_LIBRARY} ff ${GMP_LIBRARY} ${GMPXX_LIBRARY} ${BOOST_LIBS_4_BLS}) add_test(NAME bls_test COMMAND bls_test) @@ -281,7 +287,9 @@ if(BUILD_TESTS) if (EMSCRIPTEN) target_compile_options(utils_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1) set_target_properties(utils_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1") - endif() + else() + target_compile_options(utils_unit_test PRIVATE -Wno-format-overflow) + endif() target_link_libraries(utils_unit_test PRIVATE bls te ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY} ${BOOST_LIBS_4_BLS}) add_test(NAME utils_tests COMMAND utils_unit_test) diff --git a/third_party/cryptlite/sha256.h b/third_party/cryptlite/sha256.h index 8298a52c..b1260684 100644 --- a/third_party/cryptlite/sha256.h +++ b/third_party/cryptlite/sha256.h @@ -22,6 +22,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" + #ifndef _CRYPTLITE_SHA256_H_ #define _CRYPTLITE_SHA256_H_ #include diff --git a/threshold_encryption/CMakeLists.txt b/threshold_encryption/CMakeLists.txt index 180eb340..653510ff 100644 --- a/threshold_encryption/CMakeLists.txt +++ b/threshold_encryption/CMakeLists.txt @@ -5,39 +5,39 @@ project(libTE) option(BUILD_TESTS "Build tests" ON) if(BUILD_TESTS) - enable_testing() + enable_testing() endif() set(sources - threshold_encryption.cpp - TEDecryptSet.cpp - TEPrivateKeyShare.cpp - TEPrivateKey.cpp - TEPublicKey.cpp - TEPublicKeyShare.cpp - ${DKG_DIR}/dkg.cpp - ${DKG_DIR}/DKGTEWrapper.cpp - ${DKG_DIR}/DKGTESecret.cpp - ${TOOLS_DIR}/utils.cpp + threshold_encryption.cpp + TEDecryptSet.cpp + TEPrivateKeyShare.cpp + TEPrivateKey.cpp + TEPublicKey.cpp + TEPublicKeyShare.cpp + ${DKG_DIR}/dkg.cpp + ${DKG_DIR}/DKGTEWrapper.cpp + ${DKG_DIR}/DKGTESecret.cpp + ${TOOLS_DIR}/utils.cpp ) set(headers - threshold_encryption.h - TEDecryptSet.h - TEPrivateKeyShare.h - TEPrivateKey.h - TEPublicKey.h - TEPublicKeyShare.h - ${DKG_DIR}/dkg.h - ${DKG_DIR}/DKGTEWrapper.h - ${DKG_DIR}/DKGTESecret.h - ${TOOLS_DIR}/utils.h + threshold_encryption.h + TEDecryptSet.h + TEPrivateKeyShare.h + TEPrivateKey.h + TEPublicKey.h + TEPublicKeyShare.h + ${DKG_DIR}/dkg.h + ${DKG_DIR}/DKGTEWrapper.h + ${DKG_DIR}/DKGTESecret.h + ${TOOLS_DIR}/utils.h ) set(PROJECT_VERSION 0.2.0) -set (THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../) -set (TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../) +set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../) +set(TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../) add_library(te ${sources} ${headers}) @@ -58,37 +58,40 @@ if (EMSCRIPTEN) endif() if (BUILD_TESTS) - add_executable(te_unit_test ../test/unit_tests_te.cpp) - target_include_directories(te_unit_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${THIRD_PARTY_DIR}) + add_executable(te_unit_test ../test/unit_tests_te.cpp) + target_include_directories(te_unit_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${THIRD_PARTY_DIR}) if (EMSCRIPTEN) - target_compile_options(te_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1) - set_target_properties(te_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1") - endif() + target_compile_options(te_unit_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1) + set_target_properties(te_unit_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1") + else() + target_compile_options(te_unit_test PRIVATE -Wno-format-overflow) + endif() target_link_libraries(te_unit_test PRIVATE te ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY}) - add_test(NAME te_tests COMMAND te_unit_test) + add_test(NAME te_tests COMMAND te_unit_test) add_executable(te_test ../test/test_TE_wrappers.cpp) target_include_directories(te_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${THIRD_PARTY_DIR}) if (EMSCRIPTEN) - target_compile_options(te_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1) - set_target_properties(te_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1") - endif() + target_compile_options(te_test PRIVATE -s DISABLE_EXCEPTION_CATCHING=1) + set_target_properties(te_test PROPERTIES LINK_FLAGS "-s DISABLE_EXCEPTION_CATCHING=1") + else() + target_compile_options(te_test PRIVATE -Wno-format-overflow) + endif() target_link_libraries(te_test PRIVATE te ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY}) if (EMSCRIPTEN) add_executable(encrypt_message ../test/encryptMessageJS.cpp) target_include_directories(encrypt_message PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${THIRD_PARTY_DIR}) - target_compile_options(encrypt_message PRIVATE -s DISABLE_EXCEPTION_CATCHING=1) - set_target_properties(encrypt_message PROPERTIES LINK_FLAGS "-s EXIT_RUNTIME=1 -s USE_PTHREADS=0 -s EXPORTED_FUNCTIONS=['_main'] -s MAIN_MODULE=1 --bind") + target_compile_options(encrypt_message PRIVATE -s DISABLE_EXCEPTION_CATCHING=1) + set_target_properties(encrypt_message PROPERTIES LINK_FLAGS "-s EXIT_RUNTIME=1 -s USE_PTHREADS=0 -s EXPORTED_FUNCTIONS=['_main'] -s MAIN_MODULE=1 --bind") target_link_libraries(encrypt_message PRIVATE te ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY}) endif() if(NOT EMSCRIPTEN AND NOT APPLE) add_executable(te_sample_sgx ../test/te_sample_sgx.cpp) - target_include_directories(te_sample_sgx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${THIRD_PARTY_DIR}) - target_link_libraries(te_sample_sgx PRIVATE te bls ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY} - jsonrpccpp-client jsonrpccpp-server jsonrpccpp-common jsoncpp curl pthread ssl crypto z idn2) + target_include_directories(te_sample_sgx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${THIRD_PARTY_DIR}) + target_link_libraries(te_sample_sgx PRIVATE te bls ${CRYPTOPP_LIBRARY} ff ${GMPXX_LIBRARY} ${GMP_LIBRARY} jsonrpccpp-client jsonrpccpp-server jsonrpccpp-common jsoncpp curl pthread ssl crypto z idn2) endif() add_test(NAME te_wrap_tests COMMAND te_unit_test)