mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-27 01:48:17 +00:00
pass version/lock_time parameters from SignTx message to signing_init function
This commit is contained in:
parent
d77152b5a5
commit
d8aeb63854
@ -404,7 +404,7 @@ void fsm_msgSignTx(SignTx *msg)
|
||||
const HDNode *node = fsm_getDerivedNode(0, 0);
|
||||
if (!node) return;
|
||||
|
||||
signing_init(msg->inputs_count, msg->outputs_count, coin, node);
|
||||
signing_init(msg->inputs_count, msg->outputs_count, coin, node, msg->version, msg->lock_time);
|
||||
}
|
||||
|
||||
void fsm_msgCancel(Cancel *msg)
|
||||
|
@ -12,7 +12,11 @@ const char SignMessage_coin_name_default[17] = "Bitcoin";
|
||||
const char EncryptMessage_coin_name_default[17] = "Bitcoin";
|
||||
const char EstimateTxSize_coin_name_default[17] = "Bitcoin";
|
||||
const char SignTx_coin_name_default[17] = "Bitcoin";
|
||||
const uint32_t SignTx_version_default = 1u;
|
||||
const uint32_t SignTx_lock_time_default = 0u;
|
||||
const char SimpleSignTx_coin_name_default[17] = "Bitcoin";
|
||||
const uint32_t SimpleSignTx_version_default = 1u;
|
||||
const uint32_t SimpleSignTx_lock_time_default = 0u;
|
||||
|
||||
|
||||
const pb_field_t Initialize_fields[1] = {
|
||||
@ -280,18 +284,22 @@ const pb_field_t TxSize_fields[2] = {
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t SignTx_fields[4] = {
|
||||
const pb_field_t SignTx_fields[6] = {
|
||||
PB_FIELD2( 1, UINT32 , REQUIRED, STATIC , FIRST, SignTx, outputs_count, outputs_count, 0),
|
||||
PB_FIELD2( 2, UINT32 , REQUIRED, STATIC , OTHER, SignTx, inputs_count, outputs_count, 0),
|
||||
PB_FIELD2( 3, STRING , OPTIONAL, STATIC , OTHER, SignTx, coin_name, inputs_count, &SignTx_coin_name_default),
|
||||
PB_FIELD2( 4, UINT32 , OPTIONAL, STATIC , OTHER, SignTx, version, coin_name, &SignTx_version_default),
|
||||
PB_FIELD2( 5, UINT32 , OPTIONAL, STATIC , OTHER, SignTx, lock_time, version, &SignTx_lock_time_default),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t SimpleSignTx_fields[5] = {
|
||||
const pb_field_t SimpleSignTx_fields[7] = {
|
||||
PB_FIELD2( 1, MESSAGE , REPEATED, STATIC , FIRST, SimpleSignTx, inputs, inputs, &TxInputType_fields),
|
||||
PB_FIELD2( 2, MESSAGE , REPEATED, STATIC , OTHER, SimpleSignTx, outputs, inputs, &TxOutputType_fields),
|
||||
PB_FIELD2( 3, MESSAGE , REPEATED, STATIC , OTHER, SimpleSignTx, transactions, outputs, &TransactionType_fields),
|
||||
PB_FIELD2( 4, STRING , OPTIONAL, STATIC , OTHER, SimpleSignTx, coin_name, transactions, &SimpleSignTx_coin_name_default),
|
||||
PB_FIELD2( 5, UINT32 , OPTIONAL, STATIC , OTHER, SimpleSignTx, version, coin_name, &SimpleSignTx_version_default),
|
||||
PB_FIELD2( 6, UINT32 , OPTIONAL, STATIC , OTHER, SimpleSignTx, lock_time, version, &SimpleSignTx_lock_time_default),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
@ -553,6 +553,10 @@ typedef struct _SignTx {
|
||||
uint32_t inputs_count;
|
||||
bool has_coin_name;
|
||||
char coin_name[17];
|
||||
bool has_version;
|
||||
uint32_t version;
|
||||
bool has_lock_time;
|
||||
uint32_t lock_time;
|
||||
} SignTx;
|
||||
|
||||
typedef struct {
|
||||
@ -583,6 +587,10 @@ typedef struct _SimpleSignTx {
|
||||
TransactionType transactions[0];
|
||||
bool has_coin_name;
|
||||
char coin_name[17];
|
||||
bool has_version;
|
||||
uint32_t version;
|
||||
bool has_lock_time;
|
||||
uint32_t lock_time;
|
||||
} SimpleSignTx;
|
||||
|
||||
typedef struct _Success {
|
||||
@ -642,7 +650,11 @@ extern const char SignMessage_coin_name_default[17];
|
||||
extern const char EncryptMessage_coin_name_default[17];
|
||||
extern const char EstimateTxSize_coin_name_default[17];
|
||||
extern const char SignTx_coin_name_default[17];
|
||||
extern const uint32_t SignTx_version_default;
|
||||
extern const uint32_t SignTx_lock_time_default;
|
||||
extern const char SimpleSignTx_coin_name_default[17];
|
||||
extern const uint32_t SimpleSignTx_version_default;
|
||||
extern const uint32_t SimpleSignTx_lock_time_default;
|
||||
|
||||
/* Initializer values for message structs */
|
||||
#define Initialize_init_default {0}
|
||||
@ -686,8 +698,8 @@ extern const char SimpleSignTx_coin_name_default[17];
|
||||
#define CipheredKeyValue_init_default {false, {0, {0}}}
|
||||
#define EstimateTxSize_init_default {0, 0, false, "Bitcoin"}
|
||||
#define TxSize_init_default {false, 0}
|
||||
#define SignTx_init_default {0, 0, false, "Bitcoin"}
|
||||
#define SimpleSignTx_init_default {0, {}, 0, {}, 0, {}, false, "Bitcoin"}
|
||||
#define SignTx_init_default {0, 0, false, "Bitcoin", false, 1u, false, 0u}
|
||||
#define SimpleSignTx_init_default {0, {}, 0, {}, 0, {}, false, "Bitcoin", false, 1u, false, 0u}
|
||||
#define TxRequest_init_default {false, (RequestType)0, false, TxRequestDetailsType_init_default, false, TxRequestSerializedType_init_default}
|
||||
#define TxAck_init_default {false, TransactionType_init_default}
|
||||
#define SignIdentity_init_default {false, IdentityType_init_default, false, {0, {0}}, false, "", false, ""}
|
||||
@ -740,8 +752,8 @@ extern const char SimpleSignTx_coin_name_default[17];
|
||||
#define CipheredKeyValue_init_zero {false, {0, {0}}}
|
||||
#define EstimateTxSize_init_zero {0, 0, false, ""}
|
||||
#define TxSize_init_zero {false, 0}
|
||||
#define SignTx_init_zero {0, 0, false, ""}
|
||||
#define SimpleSignTx_init_zero {0, {}, 0, {}, 0, {}, false, ""}
|
||||
#define SignTx_init_zero {0, 0, false, "", false, 0, false, 0}
|
||||
#define SimpleSignTx_init_zero {0, {}, 0, {}, 0, {}, false, "", false, 0, false, 0}
|
||||
#define TxRequest_init_zero {false, (RequestType)0, false, TxRequestDetailsType_init_zero, false, TxRequestSerializedType_init_zero}
|
||||
#define TxAck_init_zero {false, TransactionType_init_zero}
|
||||
#define SignIdentity_init_zero {false, IdentityType_init_zero, false, {0, {0}}, false, "", false, ""}
|
||||
@ -872,6 +884,8 @@ extern const char SimpleSignTx_coin_name_default[17];
|
||||
#define SignTx_outputs_count_tag 1
|
||||
#define SignTx_inputs_count_tag 2
|
||||
#define SignTx_coin_name_tag 3
|
||||
#define SignTx_version_tag 4
|
||||
#define SignTx_lock_time_tag 5
|
||||
#define SignedIdentity_address_tag 1
|
||||
#define SignedIdentity_public_key_tag 2
|
||||
#define SignedIdentity_signature_tag 3
|
||||
@ -879,6 +893,8 @@ extern const char SimpleSignTx_coin_name_default[17];
|
||||
#define SimpleSignTx_outputs_tag 2
|
||||
#define SimpleSignTx_transactions_tag 3
|
||||
#define SimpleSignTx_coin_name_tag 4
|
||||
#define SimpleSignTx_version_tag 5
|
||||
#define SimpleSignTx_lock_time_tag 6
|
||||
#define Success_message_tag 1
|
||||
#define TxAck_tx_tag 1
|
||||
#define TxRequest_request_type_tag 1
|
||||
@ -932,8 +948,8 @@ extern const pb_field_t CipherKeyValue_fields[8];
|
||||
extern const pb_field_t CipheredKeyValue_fields[2];
|
||||
extern const pb_field_t EstimateTxSize_fields[4];
|
||||
extern const pb_field_t TxSize_fields[2];
|
||||
extern const pb_field_t SignTx_fields[4];
|
||||
extern const pb_field_t SimpleSignTx_fields[5];
|
||||
extern const pb_field_t SignTx_fields[6];
|
||||
extern const pb_field_t SimpleSignTx_fields[7];
|
||||
extern const pb_field_t TxRequest_fields[4];
|
||||
extern const pb_field_t TxAck_fields[2];
|
||||
extern const pb_field_t SignIdentity_fields[5];
|
||||
@ -988,8 +1004,8 @@ extern const pb_field_t DebugLinkLog_fields[4];
|
||||
#define CipheredKeyValue_size 1027
|
||||
#define EstimateTxSize_size 31
|
||||
#define TxSize_size 6
|
||||
#define SignTx_size 31
|
||||
#define SimpleSignTx_size (19 + 0*TxInputType_size + 0*TxOutputType_size + 0*TransactionType_size)
|
||||
#define SignTx_size 43
|
||||
#define SimpleSignTx_size (31 + 0*TxInputType_size + 0*TxOutputType_size + 0*TransactionType_size)
|
||||
#define TxRequest_size (18 + TxRequestDetailsType_size + TxRequestSerializedType_size)
|
||||
#define TxAck_size (6 + TransactionType_size)
|
||||
#define SignIdentity_size (558 + IdentityType_size)
|
||||
|
@ -51,8 +51,8 @@ static TxStruct to, tp, ti;
|
||||
static SHA256_CTX tc;
|
||||
static uint8_t hash[32], hash_check[32], privkey[32], pubkey[33], sig[64];
|
||||
static uint64_t to_spend, spending, change_spend;
|
||||
const uint32_t version = 1;
|
||||
const uint32_t lock_time = 0;
|
||||
static uint32_t version = 1;
|
||||
static uint32_t lock_time = 0;
|
||||
static uint32_t progress, progress_step, progress_meta_step;
|
||||
static bool multisig_fp_set, multisig_fp_mismatch;
|
||||
static uint8_t multisig_fp[32];
|
||||
@ -224,12 +224,14 @@ void send_req_finished(void)
|
||||
msg_write(MessageType_MessageType_TxRequest, &resp);
|
||||
}
|
||||
|
||||
void signing_init(uint32_t _inputs_count, uint32_t _outputs_count, const CoinType *_coin, const HDNode *_root)
|
||||
void signing_init(uint32_t _inputs_count, uint32_t _outputs_count, const CoinType *_coin, const HDNode *_root, uint32_t _version, uint32_t _lock_time)
|
||||
{
|
||||
inputs_count = _inputs_count;
|
||||
outputs_count = _outputs_count;
|
||||
coin = _coin;
|
||||
root = _root;
|
||||
version = _version;
|
||||
lock_time = _lock_time;
|
||||
|
||||
idx1 = 0;
|
||||
to_spend = 0;
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "bip32.h"
|
||||
#include "types.pb.h"
|
||||
|
||||
void signing_init(uint32_t _inputs_count, uint32_t _outputs_count, const CoinType *_coin, const HDNode *_root);
|
||||
void signing_init(uint32_t _inputs_count, uint32_t _outputs_count, const CoinType *_coin, const HDNode *_root, uint32_t _version, uint32_t _lock_time);
|
||||
void signing_abort(void);
|
||||
void signing_txack(TransactionType *tx);
|
||||
|
||||
|
2
vendor/libopencm3
vendored
2
vendor/libopencm3
vendored
@ -1 +1 @@
|
||||
Subproject commit 6d4a7d1d0c2697e5a515e4943d4734987979a7cf
|
||||
Subproject commit d3fff11c1f68b706591c0d51c82d18a0bc88dc17
|
2
vendor/trezor-common
vendored
2
vendor/trezor-common
vendored
@ -1 +1 @@
|
||||
Subproject commit 4eca753fcfb94acdb87f73e05c4235bb5420a5a1
|
||||
Subproject commit 0567a429cfc8c6fdf9e08c79270750c102fc4f70
|
2
vendor/trezor-crypto
vendored
2
vendor/trezor-crypto
vendored
@ -1 +1 @@
|
||||
Subproject commit bb52cb4ac93dd36e22bac7fef003f5b5488f2e08
|
||||
Subproject commit f4dd151eb9ef989b88dc79218a2b0115934e4268
|
Loading…
Reference in New Issue
Block a user