-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from igorkh-fb/cmake-build
CMake build system
- Loading branch information
Showing
11 changed files
with
189 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
project(mpc-lib LANGUAGES C CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
if(NOT TARGET OpenSSL::Crypto) | ||
set(OPENSSL_USE_STATIC_LIBS TRUE) | ||
find_package(OpenSSL 1.1.1 EXACT REQUIRED) | ||
endif() | ||
|
||
add_subdirectory(src/common) | ||
|
||
if(NOT MPC_LIB_SKIP_TESTS) | ||
enable_testing() | ||
add_subdirectory(test) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
set(COSIGNER_FILES | ||
blockchain/mpc/hd_derive.cpp | ||
crypto/commitments/commitments.c | ||
crypto/commitments/ring_pedersen.c | ||
crypto/drng/drng.c | ||
crypto/ed25519_algebra/ed25519_algebra.c | ||
crypto/GFp_curve_algebra/GFp_curve_algebra.c | ||
crypto/keccak1600/keccak1600.c | ||
crypto/paillier/paillier_zkp.c | ||
crypto/paillier/paillier.c | ||
crypto/shamir_secret_sharing/verifiable_secret_sharing.c | ||
crypto/zero_knowledge_proof/diffie_hellman_log.c | ||
crypto/zero_knowledge_proof/range_proofs.c | ||
crypto/zero_knowledge_proof/schnorr.c | ||
cosigner/asymmetric_eddsa_cosigner_client.cpp | ||
cosigner/asymmetric_eddsa_cosigner_server.cpp | ||
cosigner/asymmetric_eddsa_cosigner.cpp | ||
cosigner/cmp_ecdsa_offline_signing_service.cpp | ||
cosigner/cmp_ecdsa_online_signing_service.cpp | ||
cosigner/cmp_ecdsa_signing_service.cpp | ||
cosigner/cmp_offline_refresh_service.cpp | ||
cosigner/cmp_setup_service.cpp | ||
cosigner/cosigner_exception.cpp | ||
cosigner/eddsa_online_signing_service.cpp | ||
cosigner/mta.cpp | ||
cosigner/utils.cpp | ||
logging/logging_t.c | ||
) | ||
|
||
add_library(cosigner SHARED ${COSIGNER_FILES}) | ||
|
||
target_compile_options(cosigner PRIVATE | ||
-Wall -Wextra -Wvla -Wswitch-enum -Wno-missing-field-initializers -Wno-unknown-pragmas -fstack-protector-strong -fdiagnostics-color=always | ||
$<$<COMPILE_LANGUAGE:CXX>: | ||
-Wno-overloaded-virtual | ||
> | ||
$<$<CONFIG:Debug>: | ||
-Wformat -Wformat-security | ||
> | ||
$<$<NOT:$<CONFIG:Debug>>: | ||
-DNDEBUG -UEDEBUG -UDEBUG | ||
> | ||
) | ||
|
||
set(LINKER_VERSION_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/lib.lds) | ||
target_link_options(cosigner PRIVATE | ||
"LINKER:--version-script=${LINKER_VERSION_SCRIPT}" | ||
"LINKER:--no-undefined") | ||
set_target_properties(cosigner PROPERTIES LINK_DEPENDS ${LINKER_VERSION_SCRIPT}) | ||
|
||
target_include_directories(cosigner PUBLIC ${PROJECT_SOURCE_DIR}/include) | ||
target_link_libraries(cosigner PUBLIC OpenSSL::Crypto) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
add_subdirectory(cosigner) | ||
add_subdirectory(crypto/drng) | ||
add_subdirectory(crypto/ed25519_algebra) | ||
add_subdirectory(crypto/paillier) | ||
add_subdirectory(crypto/secp256k1_algebra) | ||
add_subdirectory(crypto/shamir_secret_sharing) | ||
add_subdirectory(crypto/zero_knowledge_proof) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
add_executable(cosigner_test | ||
ecdsa_offline_test.cpp | ||
ecdsa_online_test.cpp | ||
eddsa_offline_test.cpp | ||
eddsa_online_test.cpp | ||
main.cpp | ||
setup_test.cpp | ||
) | ||
|
||
find_package(Threads REQUIRED) | ||
|
||
include(FindPkgConfig) | ||
pkg_check_modules(UUID REQUIRED IMPORTED_TARGET uuid) | ||
|
||
target_link_libraries(cosigner_test PRIVATE cosigner Threads::Threads PkgConfig::UUID) | ||
|
||
add_test(NAME cosigner_test COMMAND cosigner_test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
add_executable(drng_test | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/drng/drng.c | ||
main.cpp | ||
) | ||
|
||
target_include_directories(drng_test PRIVATE ${PROJECT_SOURCE_DIR}/include) | ||
target_compile_options(drng_test PRIVATE -Wall -Wextra) | ||
target_link_libraries(drng_test PRIVATE OpenSSL::Crypto) | ||
|
||
add_test(NAME drng_test COMMAND drng_test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
add_executable(ed25519_algebra_test | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/ed25519_algebra/ed25519_algebra.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/keccak1600/keccak1600.c | ||
main.cpp | ||
) | ||
|
||
target_include_directories(ed25519_algebra_test PRIVATE ${PROJECT_SOURCE_DIR}/include) | ||
target_compile_options(ed25519_algebra_test PRIVATE -Wall -Wextra) | ||
target_link_libraries(ed25519_algebra_test PRIVATE OpenSSL::Crypto) | ||
|
||
add_test(NAME ed25519_algebra_test COMMAND ed25519_algebra_test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
add_executable(paillier_test | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/paillier/paillier_zkp.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/paillier/paillier.c | ||
main.cpp | ||
) | ||
|
||
target_include_directories(paillier_test PRIVATE ${PROJECT_SOURCE_DIR}/include) | ||
target_compile_options(paillier_test PRIVATE -Wall -Wextra) | ||
target_link_libraries(paillier_test PRIVATE OpenSSL::Crypto) | ||
|
||
add_test(NAME paillier_test COMMAND paillier_test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
add_executable(secp256k1_algebra_test | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/GFp_curve_algebra/GFp_curve_algebra.c | ||
main.cpp | ||
) | ||
|
||
target_include_directories(secp256k1_algebra_test PRIVATE ${PROJECT_SOURCE_DIR}/include) | ||
target_compile_options(secp256k1_algebra_test PRIVATE -Wall -Wextra) | ||
target_link_libraries(secp256k1_algebra_test PRIVATE OpenSSL::Crypto) | ||
|
||
add_test(NAME secp256k1_algebra_test COMMAND secp256k1_algebra_test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
add_executable(shamir_secret_sharing_test | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/commitments/commitments.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/ed25519_algebra/ed25519_algebra.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/GFp_curve_algebra/GFp_curve_algebra.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/keccak1600/keccak1600.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/shamir_secret_sharing/verifiable_secret_sharing.c | ||
main.cpp | ||
) | ||
|
||
target_include_directories(shamir_secret_sharing_test PRIVATE ${PROJECT_SOURCE_DIR}/include) | ||
target_compile_options(shamir_secret_sharing_test PRIVATE -Wall -Wextra) | ||
target_link_libraries(shamir_secret_sharing_test PRIVATE OpenSSL::Crypto) | ||
|
||
add_test(NAME shamir_secret_sharing_test COMMAND shamir_secret_sharing_test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
add_executable(zero_knowledge_proof_test | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/commitments/ring_pedersen.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/drng/drng.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/ed25519_algebra/ed25519_algebra.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/GFp_curve_algebra/GFp_curve_algebra.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/keccak1600/keccak1600.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/paillier/paillier.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/zero_knowledge_proof/diffie_hellman_log.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/zero_knowledge_proof/range_proofs.c | ||
${PROJECT_SOURCE_DIR}/src/common/crypto/zero_knowledge_proof/schnorr.c | ||
main.cpp | ||
) | ||
|
||
target_include_directories(zero_knowledge_proof_test PRIVATE ${PROJECT_SOURCE_DIR}/include) | ||
target_compile_options(zero_knowledge_proof_test PRIVATE -Wall -Wextra) | ||
target_link_libraries(zero_knowledge_proof_test PRIVATE OpenSSL::Crypto) | ||
|
||
add_test(NAME zero_knowledge_proof_test COMMAND zero_knowledge_proof_test) |