From 3f51bc36286216e0282a4786cfbc037ebafed6bf Mon Sep 17 00:00:00 2001 From: Saleem Rashid Date: Sun, 10 Dec 2017 19:22:31 +0000 Subject: [PATCH] signing: Use SignTx in signing_init --- firmware/fsm.c | 2 +- firmware/signing.c | 10 +++++----- firmware/signing.h | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/firmware/fsm.c b/firmware/fsm.c index 4ad289215..6616b9e3e 100644 --- a/firmware/fsm.c +++ b/firmware/fsm.c @@ -541,7 +541,7 @@ void fsm_msgSignTx(SignTx *msg) const HDNode *node = fsm_getDerivedNode(coin->curve_name, NULL, 0, NULL); if (!node) return; - signing_init(msg->inputs_count, msg->outputs_count, coin, node, msg->version, msg->lock_time); + signing_init(msg, coin, node); } void fsm_msgTxAck(TxAck *msg) diff --git a/firmware/signing.c b/firmware/signing.c index 3c7003408..50e94c892 100644 --- a/firmware/signing.c +++ b/firmware/signing.c @@ -430,14 +430,14 @@ bool compile_input_script_sig(TxInputType *tinput) return tinput->script_sig.size > 0; } -void signing_init(uint32_t _inputs_count, uint32_t _outputs_count, const CoinInfo *_coin, const HDNode *_root, uint32_t _version, uint32_t _lock_time) +void signing_init(const SignTx *msg, const CoinInfo *_coin, const HDNode *_root) { - inputs_count = _inputs_count; - outputs_count = _outputs_count; + inputs_count = msg->inputs_count; + outputs_count = msg->outputs_count; coin = _coin; root = _root; - version = _version; - lock_time = _lock_time; + version = msg->version; + lock_time = msg->lock_time; tx_weight = 4 * (TXSIZE_HEADER + TXSIZE_FOOTER + ser_length_size(inputs_count) diff --git a/firmware/signing.h b/firmware/signing.h index e4ee8c55d..68c3ccf53 100644 --- a/firmware/signing.h +++ b/firmware/signing.h @@ -25,9 +25,10 @@ #include "bip32.h" #include "coins.h" #include "hasher.h" +#include "messages.pb.h" #include "types.pb.h" -void signing_init(uint32_t _inputs_count, uint32_t _outputs_count, const CoinInfo *_coin, const HDNode *_root, uint32_t _version, uint32_t _lock_time); +void signing_init(const SignTx *msg, const CoinInfo *_coin, const HDNode *_root); void signing_abort(void); void signing_txack(TransactionType *tx);