1
0
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:
Pavol Rusnak 2015-02-24 15:17:49 +01:00
parent 399d4d31b7
commit 137a60ce01
2 changed files with 22 additions and 18 deletions

View File

@ -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) {

View File

@ -279,8 +279,8 @@ 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) {
@ -300,6 +300,9 @@ void signing_txack(TransactionType *tx)
multisig_fp_set = true; 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));
send_req_2_prev_meta(); send_req_2_prev_meta();