mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-14 09:20:55 +00:00
transaction: Do not hardcode HASHER_SHA2
This commit is contained in:
parent
54b0869535
commit
a1e911aa4c
@ -463,7 +463,7 @@ void signing_init(uint32_t _inputs_count, uint32_t _outputs_count, const CoinInf
|
||||
multisig_fp_mismatch = false;
|
||||
next_nonsegwit_input = 0xffffffff;
|
||||
|
||||
tx_init(&to, inputs_count, outputs_count, version, lock_time, 0);
|
||||
tx_init(&to, inputs_count, outputs_count, version, lock_time, 0, coin->hasher_type);
|
||||
// segwit hashes for hashPrevouts and hashSequence
|
||||
hasher_Init(&hashers[0], coin->hasher_type);
|
||||
hasher_Init(&hashers[1], coin->hasher_type);
|
||||
@ -883,7 +883,7 @@ void signing_txack(TransactionType *tx)
|
||||
}
|
||||
return;
|
||||
case STAGE_REQUEST_2_PREV_META:
|
||||
tx_init(&tp, tx->inputs_cnt, tx->outputs_cnt, tx->version, tx->lock_time, tx->extra_data_len);
|
||||
tx_init(&tp, tx->inputs_cnt, tx->outputs_cnt, tx->version, tx->lock_time, tx->extra_data_len, coin->hasher_type);
|
||||
progress_meta_step = progress_step / (tp.inputs_len + tp.outputs_len);
|
||||
idx2 = 0;
|
||||
if (tp.inputs_len > 0) {
|
||||
@ -957,7 +957,7 @@ void signing_txack(TransactionType *tx)
|
||||
case STAGE_REQUEST_4_INPUT:
|
||||
progress = 500 + ((signatures * progress_step + idx2 * progress_meta_step) >> PROGRESS_PRECISION);
|
||||
if (idx2 == 0) {
|
||||
tx_init(&ti, inputs_count, outputs_count, version, lock_time, 0);
|
||||
tx_init(&ti, inputs_count, outputs_count, version, lock_time, 0, coin->hasher_type);
|
||||
hasher_Reset(&hashers[0]);
|
||||
}
|
||||
// check prevouts and script type
|
||||
|
@ -561,7 +561,7 @@ uint32_t tx_serialize_extra_data_hash(TxStruct *tx, const uint8_t *data, uint32_
|
||||
return datalen;
|
||||
}
|
||||
|
||||
void tx_init(TxStruct *tx, uint32_t inputs_len, uint32_t outputs_len, uint32_t version, uint32_t lock_time, uint32_t extra_data_len)
|
||||
void tx_init(TxStruct *tx, uint32_t inputs_len, uint32_t outputs_len, uint32_t version, uint32_t lock_time, uint32_t extra_data_len, HasherType hasher_type)
|
||||
{
|
||||
tx->inputs_len = inputs_len;
|
||||
tx->outputs_len = outputs_len;
|
||||
@ -573,7 +573,7 @@ void tx_init(TxStruct *tx, uint32_t inputs_len, uint32_t outputs_len, uint32_t v
|
||||
tx->extra_data_received = 0;
|
||||
tx->size = 0;
|
||||
tx->is_segwit = false;
|
||||
hasher_Init(&(tx->hasher), HASHER_SHA2);
|
||||
hasher_Init(&(tx->hasher), hasher_type);
|
||||
}
|
||||
|
||||
void tx_hash_final(TxStruct *t, uint8_t *hash, bool reverse)
|
||||
|
@ -65,7 +65,7 @@ uint32_t tx_serialize_footer(TxStruct *tx, uint8_t *out);
|
||||
uint32_t tx_serialize_input(TxStruct *tx, const TxInputType *input, uint8_t *out);
|
||||
uint32_t tx_serialize_output(TxStruct *tx, const TxOutputBinType *output, uint8_t *out);
|
||||
|
||||
void tx_init(TxStruct *tx, uint32_t inputs_len, uint32_t outputs_len, uint32_t version, uint32_t lock_time, uint32_t extra_data_len);
|
||||
void tx_init(TxStruct *tx, uint32_t inputs_len, uint32_t outputs_len, uint32_t version, uint32_t lock_time, uint32_t extra_data_len, HasherType hasher_type);
|
||||
uint32_t tx_serialize_header_hash(TxStruct *tx);
|
||||
uint32_t tx_serialize_input_hash(TxStruct *tx, const TxInputType *input);
|
||||
uint32_t tx_serialize_output_hash(TxStruct *tx, const TxOutputBinType *output);
|
||||
|
Loading…
Reference in New Issue
Block a user