diff --git a/dap-sdk/crypto/include/dap_sign.h b/dap-sdk/crypto/include/dap_sign.h index 958722d2dbd6c3d7c7bc09ae31f830a617c5a792..4152f63e66d873cf371fb49ee5145f3c19e8d722 100755 --- a/dap-sdk/crypto/include/dap_sign.h +++ b/dap-sdk/crypto/include/dap_sign.h @@ -137,7 +137,7 @@ uint8_t* dap_sign_get_pkey(dap_sign_t *a_sign, size_t *a_pub_key_out); bool dap_sign_get_pkey_hash(dap_sign_t *a_sign, dap_chain_hash_fast_t * a_sign_hash); bool dap_sign_match_pkey_signs(dap_sign_t *l_sign1, dap_sign_t *l_sign2); -bool dap_sign_verify_size(dap_sign_t *a_sign, size_t a_max_key_size); +bool dap_sign_verify_size(dap_sign_t *a_sign, size_t a_max_sign_size); dap_enc_key_t *dap_sign_to_enc_key(dap_sign_t * a_chain_sign); const char * dap_sign_type_to_str(dap_sign_type_t a_chain_sign_type); dap_sign_type_t dap_sign_type_from_str(const char * a_type_str); diff --git a/dap-sdk/crypto/src/dap_sign.c b/dap-sdk/crypto/src/dap_sign.c index dcf7bdbebdac3a0d9ff0443e0196e014b1008fa8..5a28e83eb5bf50159c1b8eb7069560faffabff74 100755 --- a/dap-sdk/crypto/src/dap_sign.c +++ b/dap-sdk/crypto/src/dap_sign.c @@ -390,18 +390,21 @@ bool dap_sign_match_pkey_signs(dap_sign_t *l_sign1, dap_sign_t *l_sign2) * @brief verify, if a_sign->header.sign_pkey_size and a_sign->header.sign_size bigger, then a_max_key_size * * @param a_sign signed data object - * @param a_max_key_size max size of key + * @param a_max_sign_size max size of signature * @return true * @return false */ -bool dap_sign_verify_size(dap_sign_t *a_sign, size_t a_max_key_size) +bool dap_sign_verify_size(dap_sign_t *a_sign, size_t a_max_sign_size) { - if (a_sign->header.type.type == SIG_TYPE_NULL) + if (a_sign->header.sign_size == 0 || a_sign->header.sign_pkey_size == 0 || a_sign->header.type.type == SIG_TYPE_NULL ) return false; - if (a_sign->header.sign_pkey_size > a_max_key_size) + + if (a_sign->header.sign_pkey_size > a_max_sign_size || a_sign->header.sign_size > a_max_sign_size) return false; - if (a_sign->header.sign_size == 0 || a_sign->header.sign_size > a_max_key_size) + + if (a_sign->header.sign_pkey_size + a_sign->header.sign_size + sizeof(*a_sign) > a_max_sign_size ) return false; + return true; } diff --git a/modules/chain/CMakeLists.txt b/modules/chain/CMakeLists.txt index 14bde14c8e5da1a61b6f26499376c10583c6cdf9..edf0123b07eaae9119be1f9f1997fbb5aedc5e25 100644 --- a/modules/chain/CMakeLists.txt +++ b/modules/chain/CMakeLists.txt @@ -10,7 +10,7 @@ add_library(${PROJECT_NAME} STATIC ${DAP_CHAIN_SRCS} ${DAP_CHAIN_HEADERS}) #find_package(PkgConfig REQUIRED) #pkg_search_module(GLIB REQUIRED glib-2.0) -target_link_libraries(${PROJECT_NAME} dap_chain_net_srv_xchange dap_chain_net_srv_stake_pos_delegate dap_chain_net_srv_stake_lock ${GLIB_LDFLAGS}) +target_link_libraries(${PROJECT_NAME} dap_chain_net_srv dap_chain_net_srv_xchange dap_chain_net_srv_stake_pos_delegate dap_chain_net_srv_stake_lock ${GLIB_LDFLAGS}) target_include_directories(${PROJECT_NAME} INTERFACE . include/ ${GLIB_INCLUDE_DIRS}) target_include_directories(${PROJECT_NAME} PUBLIC include) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/uthash/src) diff --git a/modules/service/stake_pos_delegate/CMakeLists.txt b/modules/service/stake_pos_delegate/CMakeLists.txt index 8413e50cdea14fb7e30d2af33097e88f1b713226..6cf03e2d8c7c83848a7d2a248738fcf222d5ceb2 100644 --- a/modules/service/stake_pos_delegate/CMakeLists.txt +++ b/modules/service/stake_pos_delegate/CMakeLists.txt @@ -9,4 +9,4 @@ add_library(${PROJECT_NAME} STATIC ${DAP_SRV_STAKE_POS_DELEGATE_SRCS} ${DAP_SRV_ target_include_directories(${PROJECT_NAME} INTERFACE .) target_include_directories(${PROJECT_NAME} PUBLIC include) -target_link_libraries(${PROJECT_NAME} dap_core dap_crypto dap_chain dap_chain_crypto dap_chain_net dap_chain_net_srv dap_chain_cs_dag_poa dap_chain_cs_block_ton dap_chain_cs_block_poa) +target_link_libraries(${PROJECT_NAME} dap_core dap_crypto dap_chain dap_chain_net dap_chain_net_srv dap_chain_cs_dag_poa dap_chain_cs_block_ton dap_chain_cs_block_poa) diff --git a/modules/service/xchange/CMakeLists.txt b/modules/service/xchange/CMakeLists.txt index b3ee5a1c988275abd4e389a0f520f01640b2a54a..e8184d32bbd2c5651173e8a57d8a4721ff03219e 100644 --- a/modules/service/xchange/CMakeLists.txt +++ b/modules/service/xchange/CMakeLists.txt @@ -9,4 +9,4 @@ add_library(${PROJECT_NAME} STATIC ${DAP_SRV_XCHANGE_SRCS} ${DAP_SRV_XCHANGE_HEA target_include_directories(${PROJECT_NAME} INTERFACE .) target_include_directories(${PROJECT_NAME} PUBLIC include) -target_link_libraries(${PROJECT_NAME} dap_core dap_crypto dap_chain dap_chain_crypto dap_chain_net dap_chain_net_srv) +target_link_libraries(${PROJECT_NAME} dap_core dap_crypto dap_chain dap_chain_net dap_chain_net_srv)