mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-15 09:50:57 +00:00
set multisig_fp_mismatch when non-multisig input is encountered
This commit is contained in:
parent
399d4d31b7
commit
137a60ce01
@ -281,6 +281,7 @@ enum {
|
|||||||
void msg_process(char type, uint16_t msg_id, const pb_field_t *fields, uint8_t *msg_raw, uint32_t msg_size)
|
void msg_process(char type, uint16_t msg_id, const pb_field_t *fields, uint8_t *msg_raw, uint32_t msg_size)
|
||||||
{
|
{
|
||||||
static uint8_t msg_data[MSG_IN_SIZE];
|
static uint8_t msg_data[MSG_IN_SIZE];
|
||||||
|
memset(msg_data, 0, sizeof(msg_data));
|
||||||
pb_istream_t stream = pb_istream_from_buffer(msg_raw, msg_size);
|
pb_istream_t stream = pb_istream_from_buffer(msg_raw, msg_size);
|
||||||
bool status = pb_decode(&stream, fields, msg_data);
|
bool status = pb_decode(&stream, fields, msg_data);
|
||||||
if (status) {
|
if (status) {
|
||||||
|
@ -279,26 +279,29 @@ void signing_txack(TransactionType *tx)
|
|||||||
case STAGE_REQUEST_1_INPUT:
|
case STAGE_REQUEST_1_INPUT:
|
||||||
/* compute multisig fingerprint */
|
/* compute multisig fingerprint */
|
||||||
/* (if all input share the same fingerprint, outputs having the same fingerprint will be considered as change outputs) */
|
/* (if all input share the same fingerprint, outputs having the same fingerprint will be considered as change outputs) */
|
||||||
if (tx->inputs[0].script_type == InputScriptType_SPENDMULTISIG &&
|
if (tx->inputs[0].script_type == InputScriptType_SPENDMULTISIG) {
|
||||||
tx->inputs[0].has_multisig && !multisig_fp_mismatch) {
|
if (tx->inputs[0].has_multisig && !multisig_fp_mismatch) {
|
||||||
if (multisig_fp_set) {
|
if (multisig_fp_set) {
|
||||||
uint8_t h[32];
|
uint8_t h[32];
|
||||||
if (cryptoMultisigFingerprint(&(tx->inputs[0].multisig), h) == 0) {
|
if (cryptoMultisigFingerprint(&(tx->inputs[0].multisig), h) == 0) {
|
||||||
fsm_sendFailure(FailureType_Failure_Other, "Error computing multisig fingeprint");
|
fsm_sendFailure(FailureType_Failure_Other, "Error computing multisig fingeprint");
|
||||||
signing_abort();
|
signing_abort();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
if (memcmp(multisig_fp, h, 32) != 0) {
|
||||||
|
multisig_fp_mismatch = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (cryptoMultisigFingerprint(&(tx->inputs[0].multisig), multisig_fp) == 0) {
|
||||||
|
fsm_sendFailure(FailureType_Failure_Other, "Error computing multisig fingeprint");
|
||||||
|
signing_abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
multisig_fp_set = true;
|
||||||
}
|
}
|
||||||
if (memcmp(multisig_fp, h, 32) != 0) {
|
|
||||||
multisig_fp_mismatch = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (cryptoMultisigFingerprint(&(tx->inputs[0].multisig), multisig_fp) == 0) {
|
|
||||||
fsm_sendFailure(FailureType_Failure_Other, "Error computing multisig fingeprint");
|
|
||||||
signing_abort();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
multisig_fp_set = true;
|
|
||||||
}
|
}
|
||||||
|
} else { // InputScriptType_SPENDADDRESS
|
||||||
|
multisig_fp_mismatch = true;
|
||||||
}
|
}
|
||||||
sha256_Update(&tc, (const uint8_t *)tx->inputs, sizeof(TxInputType));
|
sha256_Update(&tc, (const uint8_t *)tx->inputs, sizeof(TxInputType));
|
||||||
memcpy(&input, tx->inputs, sizeof(TxInputType));
|
memcpy(&input, tx->inputs, sizeof(TxInputType));
|
||||||
|
Loading…
Reference in New Issue
Block a user