mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-17 21:22:10 +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));
|
||||
version = msg->version;
|
||||
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
|
||||
expiry = (coin->decred || coin->overwintered) ? msg->expiry : 0;
|
||||
timestamp = coin->timestamp ? msg->timestamp : 0;
|
||||
@ -1328,6 +1350,26 @@ void signing_txack(TransactionType *tx) {
|
||||
signing_abort();
|
||||
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) {
|
||||
fsm_sendFailure(FailureType_Failure_DataError, _("Value overflow"));
|
||||
signing_abort();
|
||||
|
Loading…
Reference in New Issue
Block a user