mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-27 15:51:02 +00:00
legacy/signing: add checks for version_group_id and branch_id fields
This commit is contained in:
parent
5aea566eb5
commit
d34428eeb3
@ -489,6 +489,28 @@ void signing_init(const SignTx *msg, const CoinInfo *_coin,
|
|||||||
memcpy(&root, _root, sizeof(HDNode));
|
memcpy(&root, _root, sizeof(HDNode));
|
||||||
version = msg->version;
|
version = msg->version;
|
||||||
lock_time = msg->lock_time;
|
lock_time = msg->lock_time;
|
||||||
|
|
||||||
|
if (coin->overwintered && !msg->has_version_group_id) {
|
||||||
|
fsm_sendFailure(FailureType_Failure_DataError,
|
||||||
|
_("Version group ID must be set."));
|
||||||
|
signing_abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!coin->overwintered) {
|
||||||
|
if (msg->has_version_group_id) {
|
||||||
|
fsm_sendFailure(FailureType_Failure_DataError,
|
||||||
|
_("Version group ID not enabled on this coin."));
|
||||||
|
signing_abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg->has_branch_id) {
|
||||||
|
fsm_sendFailure(FailureType_Failure_DataError,
|
||||||
|
_("Branch ID not enabled on this coin."));
|
||||||
|
signing_abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if !BITCOIN_ONLY
|
#if !BITCOIN_ONLY
|
||||||
expiry = (coin->decred || coin->overwintered) ? msg->expiry : 0;
|
expiry = (coin->decred || coin->overwintered) ? msg->expiry : 0;
|
||||||
timestamp = coin->timestamp ? msg->timestamp : 0;
|
timestamp = coin->timestamp ? msg->timestamp : 0;
|
||||||
@ -1328,6 +1350,26 @@ void signing_txack(TransactionType *tx) {
|
|||||||
signing_abort();
|
signing_abort();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (coin->overwintered && !tx->has_version_group_id) {
|
||||||
|
fsm_sendFailure(FailureType_Failure_DataError,
|
||||||
|
_("Version group ID must be set."));
|
||||||
|
signing_abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!coin->overwintered) {
|
||||||
|
if (tx->has_version_group_id) {
|
||||||
|
fsm_sendFailure(FailureType_Failure_DataError,
|
||||||
|
_("Version group ID not enabled on this coin."));
|
||||||
|
signing_abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (tx->has_branch_id) {
|
||||||
|
fsm_sendFailure(FailureType_Failure_DataError,
|
||||||
|
_("Branch ID not enabled on this coin."));
|
||||||
|
signing_abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (tx->inputs_cnt + tx->outputs_cnt < tx->inputs_cnt) {
|
if (tx->inputs_cnt + tx->outputs_cnt < tx->inputs_cnt) {
|
||||||
fsm_sendFailure(FailureType_Failure_DataError, _("Value overflow"));
|
fsm_sendFailure(FailureType_Failure_DataError, _("Value overflow"));
|
||||||
signing_abort();
|
signing_abort();
|
||||||
|
Loading…
Reference in New Issue
Block a user