1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

chore(legacy): update code to handle protobuf changes correctly

This commit is contained in:
matejcik 2020-09-18 11:32:38 +02:00 committed by matejcik
parent 9ee7eee1eb
commit 5debebefc8
6 changed files with 23 additions and 12 deletions

View File

@ -388,7 +388,7 @@ const HDNode *cryptoMultisigPubkey(const CoinInfo *coin,
return 0;
}
if (node_ptr->chain_code.size != 32) return 0;
if (!node_ptr->has_public_key || node_ptr->public_key.size != 33) return 0;
if (node_ptr->public_key.size != 33) return 0;
static HDNode node;
if (!hdnode_from_xpub(node_ptr->depth, node_ptr->child_num,
node_ptr->chain_code.bytes, node_ptr->public_key.bytes,
@ -429,7 +429,7 @@ int cryptoMultisigFingerprint(const MultisigRedeemScriptType *multisig,
if (n < 1 || n > 15) {
return 0;
}
if (!multisig->has_m || multisig->m < 1 || multisig->m > 15) {
if (multisig->m < 1 || multisig->m > 15) {
return 0;
}
for (uint32_t i = 0; i < n; i++) {
@ -442,8 +442,7 @@ int cryptoMultisigFingerprint(const MultisigRedeemScriptType *multisig,
}
}
for (uint32_t i = 0; i < n; i++) {
if (!pubnodes[i]->has_public_key || pubnodes[i]->public_key.size != 33)
return 0;
if (pubnodes[i]->public_key.size != 33) return 0;
if (pubnodes[i]->chain_code.size != 32) return 0;
}
// minsort according to pubkey

View File

@ -56,7 +56,6 @@ void fsm_msgGetPublicKey(const GetPublicKey *msg) {
resp->node.chain_code.size = 32;
memcpy(resp->node.chain_code.bytes, node->chain_code, 32);
resp->node.has_private_key = false;
resp->node.has_public_key = true;
resp->node.public_key.size = 33;
memcpy(resp->node.public_key.bytes, node->public_key, 33);
if (node->public_key[0] == 1) {
@ -237,9 +236,6 @@ void fsm_msgSignMessage(const SignMessage *msg) {
}
void fsm_msgVerifyMessage(const VerifyMessage *msg) {
CHECK_PARAM(msg->has_address, _("No address provided"));
CHECK_PARAM(msg->has_message, _("No message provided"));
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
if (!coin) return;
layoutProgressSwipe(_("Verifying"), 0);

View File

@ -51,7 +51,6 @@ void fsm_msgEthereumGetPublicKey(const EthereumGetPublicKey *msg) {
resp->node.chain_code.size = 32;
memcpy(resp->node.chain_code.bytes, node->chain_code, 32);
resp->node.has_private_key = false;
resp->node.has_public_key = true;
resp->node.public_key.size = 33;
memcpy(resp->node.public_key.bytes, node->public_key, 33);

View File

@ -5,7 +5,8 @@ endif
SKIPPED_MESSAGES := Binance Cardano DebugMonero Eos Monero Ontology Ripple SdProtect Tezos WebAuthn \
DebugLinkRecordScreen DebugLinkReseedRandom DebugLinkShowText DebugLinkEraseSdCard DebugLinkWatchLayout \
GetOwnershipProof OwnershipProof GetOwnershipId OwnershipId AuthorizeCoinJoin DoPreauthorized \
CancelAuthorization
CancelAuthorization \
TxAckInput TxAckOutput TxAckPrev
ifeq ($(BITCOIN_ONLY), 1)
SKIPPED_MESSAGES += Ethereum Lisk NEM Stellar

View File

@ -69,3 +69,21 @@ OwnershipId.ownership_id max_size:32
AuthorizeCoinJoin.coordinator max_size:18
AuthorizeCoinJoin.address_n max_count:8
AuthorizeCoinJoin.coin_name max_size:21
TxAckInputType.address_n max_count:8
TxAckInputType.prev_hash max_size:32
TxAckInputType.script_sig max_size:1650
TxAckInputType.witness max_size:109
TxAckInputType.ownership_proof max_size:171
TxAckInputType.commitment_data max_size:32
TxAckOutputType.address max_size:130
TxAckOutputType.address_n max_count:8
TxAckOutputType.op_return_data max_size:80
TxAckPrevInputType.prev_hash max_size:32
TxAckPrevInputType.script_sig max_size:1650
TxAckPrevOutputType.script_pubkey max_size:520
TxAckPrevExtraDataWrapper.extra_data_chunk max_size:1024

View File

@ -356,7 +356,6 @@ uint32_t compile_script_sig(uint32_t address_type, const uint8_t *pubkeyhash,
uint32_t compile_script_multisig(const CoinInfo *coin,
const MultisigRedeemScriptType *multisig,
uint8_t *out) {
if (!multisig->has_m) return 0;
const uint32_t m = multisig->m;
const uint32_t n = cryptoMultisigPubkeyCount(multisig);
if (m < 1 || m > 15) return 0;
@ -386,7 +385,6 @@ uint32_t compile_script_multisig(const CoinInfo *coin,
uint32_t compile_script_multisig_hash(const CoinInfo *coin,
const MultisigRedeemScriptType *multisig,
uint8_t *hash) {
if (!multisig->has_m) return 0;
const uint32_t m = multisig->m;
const uint32_t n = cryptoMultisigPubkeyCount(multisig);
if (m < 1 || m > 15) return 0;