2019-04-26 18:27:27 +03:00
|
|
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
# Licensed under the Apache 2.0 License.
|
|
|
|
cmake_minimum_required(VERSION 3.11)
|
|
|
|
|
2019-07-16 10:59:04 +03:00
|
|
|
add_definitions(-DOE_API_VERSION=2)
|
|
|
|
|
2019-04-26 18:27:27 +03:00
|
|
|
set(CCF_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
include(${CCF_DIR}/cmake/preproject.cmake)
|
|
|
|
|
|
|
|
project(ccf C CXX)
|
|
|
|
|
|
|
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/common.cmake)
|
|
|
|
|
|
|
|
set(TEST_HOST_LOGGING_LEVEL "info")
|
|
|
|
set(ENV{BETTER_EXCEPTIONS} 1)
|
|
|
|
|
|
|
|
option(BUILD_TESTS "Build tests" ON)
|
2019-04-30 13:30:59 +03:00
|
|
|
option(BUILD_SMALLBANK "Build SmallBank sample app and clients" ON)
|
|
|
|
|
2019-04-26 18:27:27 +03:00
|
|
|
# MemberClient executable
|
|
|
|
add_executable(memberclient src/clients/memberclient.cpp)
|
|
|
|
use_client_mbedtls(memberclient)
|
|
|
|
target_link_libraries(memberclient PRIVATE
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
ccfcrypto.host
|
|
|
|
secp256k1.host
|
|
|
|
)
|
|
|
|
|
|
|
|
# Logging Client executable
|
|
|
|
add_executable(logging_client src/clients/logging_client.cpp)
|
|
|
|
use_client_mbedtls(logging_client)
|
|
|
|
target_link_libraries(logging_client PRIVATE
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
|
|
|
|
|
|
|
# SNIPPET: Logging application
|
2019-06-26 17:51:10 +03:00
|
|
|
add_enclave_lib(loggingenc ${CMAKE_CURRENT_SOURCE_DIR}/src/apps/logging/oe_sign.conf ${CMAKE_CURRENT_SOURCE_DIR}/src/apps/sample_key.pem SRCS src/apps/logging/logging.cpp src/apps/logging/stub_for_code_signing.cpp)
|
2019-04-26 18:27:27 +03:00
|
|
|
|
|
|
|
if(BUILD_TESTS)
|
|
|
|
# Tests
|
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
## Unit tests
|
|
|
|
add_unit_test(map_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/map_test.cpp)
|
|
|
|
|
Json schema: Take 3 (#113)
* Add a getApi method, listing all installed RPC method names
* Sketch RecordParams struct
* WIP
* Broken WIP
* Partial macro
* Basic examples working
* Partial file separation
* Move, rename, and fix FOR macro
* Use json get
* Build to_json from RequiredJsonFields too
* Remove unneeded pair specialisation
* Add comments, collide required and optional
* REformat
* Use new macros everywhere
* Remove unused template
* Rename getApi to listMethods
* Move frontend-specific calltypes to /rpc
* Specify GetTxHist return type
* Pretty-print client responses by default
* Add a GetSchema RPC
* Other tools demand ugly formatting by default
* mins and maxes for numerics, map of schemas
* Support _FOR_JSON_0
* Fix support for std::optional optional fields
* Test std optionals
* Define schemas for GetCommit
* More definitions for existing RPCs
* Tidy schema generation, including for vectors
* Add proper unit test
* Initial test of schema generation
* Fix failing tests
* Formatting
* Add (currently failing) test of nested structs
* Add misleadingly passing test
* Set correct expected pointers, test currently fails
* Oops - deexpand
* Correctly build pointer path for erroneous array elements
* Demonstrate invalid, not just missing, valeus
* Skeleton of json_bench
* Fix typo
* WIP
* Compare manual json parsers vs macro-defined
* mumble mumble
* Add valijson, +basic test
* Add benchmark of valijson validation
* Benchmark simple and complex structs
* Additional broken schema test
* Include pointer to parse errors
* Restore old basic translator macro
* Restore simpler macro for translators that don't need schema
* Add auto schema for private logging methods
* Add manual schema + validation for PUBLIC logging RPCs
* Match RPC format
* More RPC format fixes
* Correct scenario test target
* Add documentation entry on API schema
* Initial schema retrieval test
* Correct URLs in generated schema
* Send schema to a flat folder
* Remove unnecessary size_t max restriction
* Report non-matching schema
* Add current schemas
* Tidying
* clang-format
* Remove schema generation e2e test
* fmtlib, remove $id from schema
* Fix pointer paths
2019-06-05 12:36:50 +03:00
|
|
|
add_unit_test(json_schema
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/json_schema.cpp)
|
|
|
|
|
2019-09-04 14:03:33 +03:00
|
|
|
add_unit_test(logger_json_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/logger_json_test.cpp)
|
|
|
|
|
2019-04-26 18:27:27 +03:00
|
|
|
add_unit_test(kv_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/kv/test/kv_test.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/kv/test/kv_contention.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/kv/test/kv_serialisation.cpp)
|
2019-05-15 12:57:04 +03:00
|
|
|
use_client_mbedtls(kv_test)
|
2019-04-26 18:27:27 +03:00
|
|
|
target_link_libraries(kv_test PRIVATE
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
secp256k1.host)
|
|
|
|
|
|
|
|
add_unit_test(ds_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/ringbuffer.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/messaging.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/oversized.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/serializer.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/ds/test/hash.cpp)
|
|
|
|
target_link_libraries(ds_test PRIVATE
|
|
|
|
${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
|
|
|
|
add_unit_test(raft_test
|
2019-08-14 16:22:14 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/consensus/raft/test/main.cpp)
|
2019-04-26 18:27:27 +03:00
|
|
|
target_link_libraries(raft_test PRIVATE
|
|
|
|
${CRYPTO_LIBRARY})
|
|
|
|
|
|
|
|
add_unit_test(ledger_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/host/test/ledger.cpp)
|
|
|
|
|
|
|
|
add_unit_test(raft_enclave_test
|
2019-08-14 16:22:14 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/consensus/raft/test/enclave.cpp)
|
2019-04-26 18:27:27 +03:00
|
|
|
target_include_directories(raft_enclave_test PRIVATE
|
|
|
|
${CCFCRYPTO_INC})
|
|
|
|
target_link_libraries(raft_enclave_test PRIVATE
|
Support multiple crypto curves (#243)
* Sketch CurveImpl enum, replace macro definitions with templates
* Replace use of MD_TYPE and HASH macros with templates
* Replace HASH macro
* WIP
* Remove remaining compile-disabled code from keypair.h
* Expose CurveImpl, correct 256k1_bitcoin params
* Test all supported curves
* Add test that wrong curve fails to validate
* verify(vector, vector) should delegate, not reimplement
* Corrupt more, to ensure we affect content not padding
* Rename CURVE_CHOICE options to be LEDGER_CURVE_CHOICE
* LEDGER_CURVE_CHOICE determines default_curve_choice
* Proof-of-concept - factories for virtual implementation
* Virtualise PublicKey
* Re-enable other tests
* Remove templated CurveParameters
* Add labels, test for wrong curve, wrong impl
* Correct comment
* Delegate sign(CBuffer), reducing code duplication
* Remove TODO enum
* tls_bench compares curves for signing
* Extract make_contents
* tls_bench does comparison of all supported curves
* Tidy
* Temporary verbose logging of ecp group ID
* Produce standard (non-recoverable) signatures by default, for compatibility
* Fix curve logging, add tests of key transfer across implementations
* Verify with non-recoverable sigs too
* Log inconsistent failing cases
* Correct implementation substitutability test
* Normalize secp256k1 signatures - they may have come from mbedtls
* Re-order picobench results for readability
* Add some secp256k1 link dependencies
* Unprotect constructors - there are legitimate uses for direct construction
* Verifier curve type is parsed from cert
* history_bench builds
* Reminder TODO comment
* frontend_test builds and passes
* Clients compile
* genesisgenerator compiles
* membervoting_test builds
* Fix sign_hash, sign/verify ack data normally
* Remove unneeded CurveParams entirely
Detect PublicKey type
Simplify construction to minimum
* Correct test with new API
* verify_hash via publickey, test sign_hash and verify_hash
* Include tests
* Update to latest signature
* Ditto
* Update function signatures for people with raw data
* Fix history calls
* When constructing from explicit key, don't pass curve too
* API updates
* Fix nodestate
* inline
* EVERYTHING BUILDS
* Tidy cmake link args
* Remove unnecessary direct use of mbedtls_ecdsa_*
* Remove uint8_t restriction in sig_size
* tls_bench actually compares relevant hash operations
* bitcoin preference doesn't need to be a macro
* Standardise use of use_bitcoin_impl
* clang-format
* Test now uses distinct manual hash operation
CHECK rather than REQUIRE
* Rename LEDGER_curve to SERVICE_IDENTITY_curve
* use fmtlib
* Let mbedtls determine message digest size/function
* Add details to all thrown errors
* Remove parameter packs, document use_bitcoin_impl
* Name magic constant, extract parse_secp256k_bc
2019-07-12 13:12:05 +03:00
|
|
|
${CRYPTO_LIBRARY}
|
|
|
|
secp256k1.host)
|
2019-04-26 18:27:27 +03:00
|
|
|
|
|
|
|
add_unit_test(crypto_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/crypto/test/crypto.cpp)
|
|
|
|
target_include_directories(crypto_test PRIVATE
|
|
|
|
${CCFCRYPTO_INC})
|
|
|
|
target_link_libraries(crypto_test PRIVATE
|
|
|
|
${CRYPTO_LIBRARY})
|
|
|
|
|
|
|
|
add_unit_test(history_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/node/test/history.cpp)
|
|
|
|
target_include_directories(history_test PRIVATE
|
2019-05-29 19:36:10 +03:00
|
|
|
${EVERCRYPT_INC})
|
2019-04-26 18:27:27 +03:00
|
|
|
target_link_libraries(history_test PRIVATE
|
|
|
|
${CRYPTO_LIBRARY}
|
2019-05-29 19:36:10 +03:00
|
|
|
evercrypt.host
|
2019-04-26 18:27:27 +03:00
|
|
|
secp256k1.host)
|
|
|
|
|
|
|
|
add_unit_test(encryptor_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/node/test/encryptor.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/crypto/symmkey.cpp)
|
2019-05-15 12:57:04 +03:00
|
|
|
use_client_mbedtls(encryptor_test)
|
2019-04-26 18:27:27 +03:00
|
|
|
target_link_libraries(encryptor_test PRIVATE
|
|
|
|
secp256k1.host)
|
|
|
|
|
2019-07-16 21:44:05 +03:00
|
|
|
add_unit_test(msgpack_serialization_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/node/test/msgpack_serialization.cpp)
|
|
|
|
|
2019-04-26 18:27:27 +03:00
|
|
|
add_unit_test(tls_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/tls/test/main.cpp)
|
|
|
|
target_link_libraries(tls_test PRIVATE
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
secp256k1.host)
|
|
|
|
|
|
|
|
add_unit_test(keyexchange_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/tls/test/keyexchange.cpp)
|
2019-05-15 12:57:04 +03:00
|
|
|
use_client_mbedtls(keyexchange_test)
|
2019-04-26 18:27:27 +03:00
|
|
|
|
|
|
|
add_unit_test(channels_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/node/test/channels.cpp)
|
2019-05-15 12:57:04 +03:00
|
|
|
use_client_mbedtls(channels_test)
|
2019-04-26 18:27:27 +03:00
|
|
|
target_link_libraries(channels_test PRIVATE secp256k1.host)
|
|
|
|
|
2019-09-30 13:26:31 +03:00
|
|
|
add_unit_test(http_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/enclave/test/http.cpp)
|
|
|
|
target_link_libraries(http_test PRIVATE http_parser.host)
|
|
|
|
|
2019-07-19 15:56:29 +03:00
|
|
|
if(NOT PBFT)
|
|
|
|
add_unit_test(frontend_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/node/rpc/test/frontend_test.cpp)
|
|
|
|
target_link_libraries(frontend_test PRIVATE
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
evercrypt.host
|
|
|
|
lua.host
|
|
|
|
secp256k1.host)
|
|
|
|
|
|
|
|
add_unit_test(membervoting_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/node/rpc/test/membervoting_test.cpp)
|
|
|
|
target_link_libraries(membervoting_test PRIVATE
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
evercrypt.host
|
|
|
|
lua.host
|
|
|
|
secp256k1.host)
|
|
|
|
|
2019-09-30 15:13:42 +03:00
|
|
|
add_unit_test(nodefrontend_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/node/rpc/test/nodefrontend_test.cpp)
|
|
|
|
target_link_libraries(nodefrontend_test PRIVATE
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
evercrypt.host
|
|
|
|
lua.host
|
|
|
|
secp256k1.host)
|
|
|
|
|
2019-07-19 15:56:29 +03:00
|
|
|
if(NOT ENV{RUNTIME_CONFIG_DIR})
|
|
|
|
set_tests_properties(membervoting_test PROPERTIES ENVIRONMENT RUNTIME_CONFIG_DIR=${CMAKE_SOURCE_DIR}/src/runtime_config)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_unit_test(luageneric_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/apps/luageneric/luageneric_test.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/apps/luageneric/luageneric.cpp)
|
|
|
|
target_include_directories(luageneric_test PRIVATE
|
|
|
|
${LUA_DIR})
|
|
|
|
target_link_libraries(luageneric_test PRIVATE
|
|
|
|
lua.host
|
|
|
|
secp256k1.host)
|
|
|
|
endif()
|
2019-04-26 18:27:27 +03:00
|
|
|
|
|
|
|
add_unit_test(lua_test
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/luainterp/test/lua_test.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/luainterp/test/luakv.cpp)
|
|
|
|
target_include_directories(lua_test PRIVATE
|
|
|
|
${LUA_DIR})
|
|
|
|
target_link_libraries(lua_test PRIVATE
|
|
|
|
lua.host)
|
|
|
|
|
|
|
|
## Picobench wrapper
|
|
|
|
function(add_picobench name)
|
|
|
|
add_executable(${name}
|
|
|
|
${ARGN})
|
|
|
|
target_include_directories(${name} PRIVATE src)
|
|
|
|
# -Wall -Werror catches a number of warnings in picobench
|
|
|
|
target_include_directories(${name} SYSTEM PRIVATE 3rdparty)
|
|
|
|
add_test(
|
|
|
|
NAME ${name}
|
|
|
|
COMMAND ${name} --samples=1000)
|
|
|
|
use_client_mbedtls(${name})
|
|
|
|
target_link_libraries(${name} PRIVATE
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2019-06-21 18:27:54 +03:00
|
|
|
set_property(TEST ${name} PROPERTY LABELS benchmark)
|
2019-04-26 18:27:27 +03:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
## Picobench benchmarks
|
|
|
|
add_picobench(map_bench src/ds/test/map_bench.cpp)
|
|
|
|
add_picobench(logger_bench src/ds/test/logger_bench.cpp)
|
2019-09-04 14:03:33 +03:00
|
|
|
add_picobench(logger_json_bench src/ds/test/logger_json_bench.cpp)
|
Json schema: Take 3 (#113)
* Add a getApi method, listing all installed RPC method names
* Sketch RecordParams struct
* WIP
* Broken WIP
* Partial macro
* Basic examples working
* Partial file separation
* Move, rename, and fix FOR macro
* Use json get
* Build to_json from RequiredJsonFields too
* Remove unneeded pair specialisation
* Add comments, collide required and optional
* REformat
* Use new macros everywhere
* Remove unused template
* Rename getApi to listMethods
* Move frontend-specific calltypes to /rpc
* Specify GetTxHist return type
* Pretty-print client responses by default
* Add a GetSchema RPC
* Other tools demand ugly formatting by default
* mins and maxes for numerics, map of schemas
* Support _FOR_JSON_0
* Fix support for std::optional optional fields
* Test std optionals
* Define schemas for GetCommit
* More definitions for existing RPCs
* Tidy schema generation, including for vectors
* Add proper unit test
* Initial test of schema generation
* Fix failing tests
* Formatting
* Add (currently failing) test of nested structs
* Add misleadingly passing test
* Set correct expected pointers, test currently fails
* Oops - deexpand
* Correctly build pointer path for erroneous array elements
* Demonstrate invalid, not just missing, valeus
* Skeleton of json_bench
* Fix typo
* WIP
* Compare manual json parsers vs macro-defined
* mumble mumble
* Add valijson, +basic test
* Add benchmark of valijson validation
* Benchmark simple and complex structs
* Additional broken schema test
* Include pointer to parse errors
* Restore old basic translator macro
* Restore simpler macro for translators that don't need schema
* Add auto schema for private logging methods
* Add manual schema + validation for PUBLIC logging RPCs
* Match RPC format
* More RPC format fixes
* Correct scenario test target
* Add documentation entry on API schema
* Initial schema retrieval test
* Correct URLs in generated schema
* Send schema to a flat folder
* Remove unnecessary size_t max restriction
* Report non-matching schema
* Add current schemas
* Tidying
* clang-format
* Remove schema generation e2e test
* fmtlib, remove $id from schema
* Fix pointer paths
2019-06-05 12:36:50 +03:00
|
|
|
add_picobench(json_bench src/ds/test/json_bench.cpp)
|
2019-04-26 18:27:27 +03:00
|
|
|
add_picobench(ringbuffer_bench src/ds/test/ringbuffer_bench.cpp)
|
|
|
|
target_link_libraries(ringbuffer_bench PRIVATE
|
|
|
|
${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
add_picobench(tls_bench src/tls/test/bench.cpp)
|
|
|
|
target_link_libraries(tls_bench PRIVATE
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
secp256k1.host)
|
2019-05-13 11:35:04 +03:00
|
|
|
add_picobench(merkle_bench src/node/test/merkle_bench.cpp)
|
|
|
|
target_link_libraries(merkle_bench PRIVATE
|
|
|
|
ccfcrypto.host
|
Support multiple crypto curves (#243)
* Sketch CurveImpl enum, replace macro definitions with templates
* Replace use of MD_TYPE and HASH macros with templates
* Replace HASH macro
* WIP
* Remove remaining compile-disabled code from keypair.h
* Expose CurveImpl, correct 256k1_bitcoin params
* Test all supported curves
* Add test that wrong curve fails to validate
* verify(vector, vector) should delegate, not reimplement
* Corrupt more, to ensure we affect content not padding
* Rename CURVE_CHOICE options to be LEDGER_CURVE_CHOICE
* LEDGER_CURVE_CHOICE determines default_curve_choice
* Proof-of-concept - factories for virtual implementation
* Virtualise PublicKey
* Re-enable other tests
* Remove templated CurveParameters
* Add labels, test for wrong curve, wrong impl
* Correct comment
* Delegate sign(CBuffer), reducing code duplication
* Remove TODO enum
* tls_bench compares curves for signing
* Extract make_contents
* tls_bench does comparison of all supported curves
* Tidy
* Temporary verbose logging of ecp group ID
* Produce standard (non-recoverable) signatures by default, for compatibility
* Fix curve logging, add tests of key transfer across implementations
* Verify with non-recoverable sigs too
* Log inconsistent failing cases
* Correct implementation substitutability test
* Normalize secp256k1 signatures - they may have come from mbedtls
* Re-order picobench results for readability
* Add some secp256k1 link dependencies
* Unprotect constructors - there are legitimate uses for direct construction
* Verifier curve type is parsed from cert
* history_bench builds
* Reminder TODO comment
* frontend_test builds and passes
* Clients compile
* genesisgenerator compiles
* membervoting_test builds
* Fix sign_hash, sign/verify ack data normally
* Remove unneeded CurveParams entirely
Detect PublicKey type
Simplify construction to minimum
* Correct test with new API
* verify_hash via publickey, test sign_hash and verify_hash
* Include tests
* Update to latest signature
* Ditto
* Update function signatures for people with raw data
* Fix history calls
* When constructing from explicit key, don't pass curve too
* API updates
* Fix nodestate
* inline
* EVERYTHING BUILDS
* Tidy cmake link args
* Remove unnecessary direct use of mbedtls_ecdsa_*
* Remove uint8_t restriction in sig_size
* tls_bench actually compares relevant hash operations
* bitcoin preference doesn't need to be a macro
* Standardise use of use_bitcoin_impl
* clang-format
* Test now uses distinct manual hash operation
CHECK rather than REQUIRE
* Rename LEDGER_curve to SERVICE_IDENTITY_curve
* use fmtlib
* Let mbedtls determine message digest size/function
* Add details to all thrown errors
* Remove parameter packs, document use_bitcoin_impl
* Name magic constant, extract parse_secp256k_bc
2019-07-12 13:12:05 +03:00
|
|
|
evercrypt.host
|
|
|
|
secp256k1.host)
|
2019-05-13 11:35:04 +03:00
|
|
|
target_include_directories(merkle_bench PRIVATE
|
2019-05-29 19:36:10 +03:00
|
|
|
${EVERCRYPT_INC})
|
2019-04-26 18:27:27 +03:00
|
|
|
add_picobench(history_bench src/node/test/history_bench.cpp)
|
|
|
|
target_link_libraries(history_bench PRIVATE
|
|
|
|
ccfcrypto.host
|
2019-05-29 19:36:10 +03:00
|
|
|
evercrypt.host
|
2019-04-26 18:27:27 +03:00
|
|
|
secp256k1.host)
|
|
|
|
target_include_directories(history_bench PRIVATE
|
2019-05-29 19:36:10 +03:00
|
|
|
${EVERCRYPT_INC})
|
2019-04-26 18:27:27 +03:00
|
|
|
add_picobench(kv_bench src/kv/test/kv_bench.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/crypto/symmkey.cpp)
|
|
|
|
|
2019-05-13 17:14:17 +03:00
|
|
|
# Merkle Tree memory test
|
|
|
|
add_executable(merkle_mem src/node/test/merkle_mem.cpp)
|
|
|
|
target_link_libraries(merkle_mem PRIVATE
|
|
|
|
ccfcrypto.host
|
2019-05-29 19:36:10 +03:00
|
|
|
evercrypt.host
|
Support multiple crypto curves (#243)
* Sketch CurveImpl enum, replace macro definitions with templates
* Replace use of MD_TYPE and HASH macros with templates
* Replace HASH macro
* WIP
* Remove remaining compile-disabled code from keypair.h
* Expose CurveImpl, correct 256k1_bitcoin params
* Test all supported curves
* Add test that wrong curve fails to validate
* verify(vector, vector) should delegate, not reimplement
* Corrupt more, to ensure we affect content not padding
* Rename CURVE_CHOICE options to be LEDGER_CURVE_CHOICE
* LEDGER_CURVE_CHOICE determines default_curve_choice
* Proof-of-concept - factories for virtual implementation
* Virtualise PublicKey
* Re-enable other tests
* Remove templated CurveParameters
* Add labels, test for wrong curve, wrong impl
* Correct comment
* Delegate sign(CBuffer), reducing code duplication
* Remove TODO enum
* tls_bench compares curves for signing
* Extract make_contents
* tls_bench does comparison of all supported curves
* Tidy
* Temporary verbose logging of ecp group ID
* Produce standard (non-recoverable) signatures by default, for compatibility
* Fix curve logging, add tests of key transfer across implementations
* Verify with non-recoverable sigs too
* Log inconsistent failing cases
* Correct implementation substitutability test
* Normalize secp256k1 signatures - they may have come from mbedtls
* Re-order picobench results for readability
* Add some secp256k1 link dependencies
* Unprotect constructors - there are legitimate uses for direct construction
* Verifier curve type is parsed from cert
* history_bench builds
* Reminder TODO comment
* frontend_test builds and passes
* Clients compile
* genesisgenerator compiles
* membervoting_test builds
* Fix sign_hash, sign/verify ack data normally
* Remove unneeded CurveParams entirely
Detect PublicKey type
Simplify construction to minimum
* Correct test with new API
* verify_hash via publickey, test sign_hash and verify_hash
* Include tests
* Update to latest signature
* Ditto
* Update function signatures for people with raw data
* Fix history calls
* When constructing from explicit key, don't pass curve too
* API updates
* Fix nodestate
* inline
* EVERYTHING BUILDS
* Tidy cmake link args
* Remove unnecessary direct use of mbedtls_ecdsa_*
* Remove uint8_t restriction in sig_size
* tls_bench actually compares relevant hash operations
* bitcoin preference doesn't need to be a macro
* Standardise use of use_bitcoin_impl
* clang-format
* Test now uses distinct manual hash operation
CHECK rather than REQUIRE
* Rename LEDGER_curve to SERVICE_IDENTITY_curve
* use fmtlib
* Let mbedtls determine message digest size/function
* Add details to all thrown errors
* Remove parameter packs, document use_bitcoin_impl
* Name magic constant, extract parse_secp256k_bc
2019-07-12 13:12:05 +03:00
|
|
|
secp256k1.host
|
2019-05-13 17:14:17 +03:00
|
|
|
${CMAKE_THREAD_LIBS_INIT})
|
Support multiple crypto curves (#243)
* Sketch CurveImpl enum, replace macro definitions with templates
* Replace use of MD_TYPE and HASH macros with templates
* Replace HASH macro
* WIP
* Remove remaining compile-disabled code from keypair.h
* Expose CurveImpl, correct 256k1_bitcoin params
* Test all supported curves
* Add test that wrong curve fails to validate
* verify(vector, vector) should delegate, not reimplement
* Corrupt more, to ensure we affect content not padding
* Rename CURVE_CHOICE options to be LEDGER_CURVE_CHOICE
* LEDGER_CURVE_CHOICE determines default_curve_choice
* Proof-of-concept - factories for virtual implementation
* Virtualise PublicKey
* Re-enable other tests
* Remove templated CurveParameters
* Add labels, test for wrong curve, wrong impl
* Correct comment
* Delegate sign(CBuffer), reducing code duplication
* Remove TODO enum
* tls_bench compares curves for signing
* Extract make_contents
* tls_bench does comparison of all supported curves
* Tidy
* Temporary verbose logging of ecp group ID
* Produce standard (non-recoverable) signatures by default, for compatibility
* Fix curve logging, add tests of key transfer across implementations
* Verify with non-recoverable sigs too
* Log inconsistent failing cases
* Correct implementation substitutability test
* Normalize secp256k1 signatures - they may have come from mbedtls
* Re-order picobench results for readability
* Add some secp256k1 link dependencies
* Unprotect constructors - there are legitimate uses for direct construction
* Verifier curve type is parsed from cert
* history_bench builds
* Reminder TODO comment
* frontend_test builds and passes
* Clients compile
* genesisgenerator compiles
* membervoting_test builds
* Fix sign_hash, sign/verify ack data normally
* Remove unneeded CurveParams entirely
Detect PublicKey type
Simplify construction to minimum
* Correct test with new API
* verify_hash via publickey, test sign_hash and verify_hash
* Include tests
* Update to latest signature
* Ditto
* Update function signatures for people with raw data
* Fix history calls
* When constructing from explicit key, don't pass curve too
* API updates
* Fix nodestate
* inline
* EVERYTHING BUILDS
* Tidy cmake link args
* Remove unnecessary direct use of mbedtls_ecdsa_*
* Remove uint8_t restriction in sig_size
* tls_bench actually compares relevant hash operations
* bitcoin preference doesn't need to be a macro
* Standardise use of use_bitcoin_impl
* clang-format
* Test now uses distinct manual hash operation
CHECK rather than REQUIRE
* Rename LEDGER_curve to SERVICE_IDENTITY_curve
* use fmtlib
* Let mbedtls determine message digest size/function
* Add details to all thrown errors
* Remove parameter packs, document use_bitcoin_impl
* Name magic constant, extract parse_secp256k_bc
2019-07-12 13:12:05 +03:00
|
|
|
use_client_mbedtls(merkle_mem)
|
2019-05-13 17:14:17 +03:00
|
|
|
target_include_directories(merkle_mem PRIVATE
|
2019-05-29 19:36:10 +03:00
|
|
|
${EVERCRYPT_INC}
|
2019-05-13 17:14:17 +03:00
|
|
|
src)
|
|
|
|
|
2019-07-19 15:56:29 +03:00
|
|
|
if (NOT PBFT)
|
|
|
|
# Raft driver and scenario test
|
|
|
|
add_executable(raft_driver
|
2019-08-14 16:22:14 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/consensus/raft/test/driver.cpp)
|
2019-07-19 15:56:29 +03:00
|
|
|
use_client_mbedtls(raft_driver)
|
|
|
|
target_include_directories(raft_driver PRIVATE
|
|
|
|
src/raft)
|
|
|
|
add_test(
|
|
|
|
NAME raft_scenario_test
|
|
|
|
COMMAND
|
|
|
|
${PYTHON} ${CMAKE_SOURCE_DIR}/tests/raft_scenarios_runner.py ./raft_driver
|
|
|
|
${CMAKE_SOURCE_DIR}/tests/raft_scenarios ${CMAKE_SOURCE_DIR})
|
|
|
|
set_property(TEST raft_scenario_test PROPERTY LABELS raft_scenario)
|
|
|
|
|
2019-09-30 13:26:31 +03:00
|
|
|
if (NOT HTTP)
|
|
|
|
## Member client end to end tests
|
|
|
|
add_e2e_test(
|
|
|
|
NAME member_client_test
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/memberclient.py
|
|
|
|
)
|
2019-04-26 18:27:27 +03:00
|
|
|
|
2019-09-30 13:26:31 +03:00
|
|
|
## Logging client end to end test
|
2019-08-09 15:53:46 +03:00
|
|
|
add_e2e_test(
|
2019-09-30 13:26:31 +03:00
|
|
|
NAME logging_client_test
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/loggingclient.py
|
2019-08-09 15:53:46 +03:00
|
|
|
)
|
|
|
|
|
2019-09-30 13:26:31 +03:00
|
|
|
if (NOT SAN)
|
|
|
|
add_e2e_test(
|
|
|
|
NAME connections
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/connections.py
|
|
|
|
)
|
|
|
|
endif()
|
2019-04-26 18:27:27 +03:00
|
|
|
|
2019-09-30 13:26:31 +03:00
|
|
|
## Storing signed votes test
|
|
|
|
add_e2e_test(
|
|
|
|
NAME voting_history_test
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/votinghistory.py)
|
2019-06-18 17:20:31 +03:00
|
|
|
|
2019-09-30 13:26:31 +03:00
|
|
|
## Lua sample app (tx regulator) end to end test
|
2019-07-19 15:56:29 +03:00
|
|
|
add_e2e_test(
|
2019-09-30 13:26:31 +03:00
|
|
|
NAME lua_txregulator_test
|
|
|
|
PYTHON_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/samples/apps/txregulator/tests/txregulatorclient.py
|
2019-07-19 15:56:29 +03:00
|
|
|
ADDITIONAL_ARGS
|
2019-09-30 13:26:31 +03:00
|
|
|
--app-script ${CMAKE_CURRENT_SOURCE_DIR}/samples/apps/txregulator/app/txregulator.lua
|
|
|
|
--datafile ${CMAKE_CURRENT_SOURCE_DIR}/samples/apps/txregulator/dataset/sample_data.csv)
|
|
|
|
|
|
|
|
if(QUOTES_ENABLED)
|
|
|
|
add_e2e_test(
|
|
|
|
NAME governance_tests
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/governance.py
|
|
|
|
ADDITIONAL_ARGS
|
|
|
|
--oesign ${OESIGN}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_e2e_test(
|
2019-10-01 19:07:29 +03:00
|
|
|
NAME reconfiguration_test
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/reconfiguration.py
|
2019-09-30 13:26:31 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
add_e2e_test(
|
|
|
|
NAME code_update_test
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/code_update.py
|
|
|
|
ADDITIONAL_ARGS
|
|
|
|
--oesign ${OESIGN}
|
|
|
|
--oeconfpath ${CMAKE_CURRENT_SOURCE_DIR}/src/apps/logging/oe_sign.conf
|
|
|
|
--oesignkeypath ${CMAKE_CURRENT_SOURCE_DIR}/src/apps/sample_key.pem
|
|
|
|
--election-timeout 1500
|
|
|
|
)
|
|
|
|
endif()
|
2019-07-19 15:56:29 +03:00
|
|
|
|
2019-09-10 13:34:21 +03:00
|
|
|
add_e2e_test(
|
2019-09-30 13:26:31 +03:00
|
|
|
NAME end_to_end_logging
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/e2e_logging.py
|
2019-09-10 13:34:21 +03:00
|
|
|
)
|
|
|
|
|
2019-10-07 17:18:10 +03:00
|
|
|
add_e2e_test(
|
|
|
|
NAME lua_end_to_end_logging
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/e2e_logging.py
|
|
|
|
ADDITIONAL_ARGS
|
|
|
|
--app-script ${CMAKE_SOURCE_DIR}/src/apps/logging/logging.lua)
|
|
|
|
|
2019-09-10 13:34:21 +03:00
|
|
|
add_e2e_test(
|
2019-09-30 13:26:31 +03:00
|
|
|
NAME end_to_end_scenario
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/e2e_scenarios.py
|
2019-09-10 13:34:21 +03:00
|
|
|
ADDITIONAL_ARGS
|
2019-09-30 13:26:31 +03:00
|
|
|
--scenario ${CMAKE_SOURCE_DIR}/tests/simple_logging_scenario.json
|
2019-09-10 13:34:21 +03:00
|
|
|
)
|
2019-04-26 18:27:27 +03:00
|
|
|
|
2019-09-30 13:26:31 +03:00
|
|
|
add_e2e_test(
|
|
|
|
NAME election_tests
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/election.py
|
|
|
|
ADDITIONAL_ARGS
|
|
|
|
--election-timeout 2000
|
|
|
|
)
|
2019-07-19 15:56:29 +03:00
|
|
|
|
2019-09-30 13:26:31 +03:00
|
|
|
add_e2e_test(
|
|
|
|
NAME recovery_tests
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/recovery.py
|
|
|
|
ADDITIONAL_ARGS
|
|
|
|
${RECOVERY_ARGS}
|
|
|
|
)
|
2019-07-19 15:56:29 +03:00
|
|
|
|
2019-09-30 13:26:31 +03:00
|
|
|
add_e2e_test(
|
|
|
|
NAME schema_tests
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/schema.py
|
|
|
|
ADDITIONAL_ARGS
|
|
|
|
-p libloggingenc
|
|
|
|
--schema-dir ${CMAKE_SOURCE_DIR}/sphinx/source/schemas
|
|
|
|
)
|
2019-07-19 15:56:29 +03:00
|
|
|
|
2019-09-30 13:26:31 +03:00
|
|
|
if (BUILD_SMALLBANK)
|
|
|
|
include(${CMAKE_CURRENT_SOURCE_DIR}/samples/apps/smallbank/smallbank.cmake)
|
|
|
|
endif()
|
2019-07-19 15:56:29 +03:00
|
|
|
|
2019-09-30 13:26:31 +03:00
|
|
|
else()
|
|
|
|
add_e2e_test(
|
|
|
|
NAME end_to_end_http
|
|
|
|
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/e2e_http.py
|
2019-07-19 15:56:29 +03:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
else()
|
2019-10-09 16:08:22 +03:00
|
|
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/epbft.cmake)
|
2019-04-30 12:14:06 +03:00
|
|
|
endif()
|
|
|
|
|
2019-04-26 18:27:27 +03:00
|
|
|
if (EXTENSIVE_TESTS)
|
|
|
|
set_tests_properties(recovery_tests PROPERTIES TIMEOUT 2000)
|
|
|
|
endif()
|
|
|
|
endif()
|