mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 17:38:39 +00:00
allow 15/15 multisig
This commit is contained in:
parent
43ff5baeab
commit
7e27275ec8
@ -606,7 +606,7 @@ void fsm_msgEncryptMessage(EncryptMessage *msg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
curve_point pubkey;
|
curve_point pubkey;
|
||||||
if ((msg->pubkey.size != 33 && msg->pubkey.size != 65) || ecdsa_read_pubkey(msg->pubkey.bytes, &pubkey) == 0) {
|
if (msg->pubkey.size != 33 || ecdsa_read_pubkey(msg->pubkey.bytes, &pubkey) == 0) {
|
||||||
fsm_sendFailure(FailureType_Failure_SyntaxError, "Invalid public key provided");
|
fsm_sendFailure(FailureType_Failure_SyntaxError, "Invalid public key provided");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ VerifyMessage.message max_size:1024
|
|||||||
MessageSignature.address max_size:35
|
MessageSignature.address max_size:35
|
||||||
MessageSignature.signature max_size:65
|
MessageSignature.signature max_size:65
|
||||||
|
|
||||||
EncryptMessage.pubkey max_size:65
|
EncryptMessage.pubkey max_size:33
|
||||||
EncryptMessage.message max_size:1024
|
EncryptMessage.message max_size:1024
|
||||||
EncryptMessage.address_n max_count:8
|
EncryptMessage.address_n max_count:8
|
||||||
EncryptMessage.coin_name max_size:17
|
EncryptMessage.coin_name max_size:17
|
||||||
|
@ -227,7 +227,7 @@ typedef struct _DecryptedMessage {
|
|||||||
char address[35];
|
char address[35];
|
||||||
} DecryptedMessage;
|
} DecryptedMessage;
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(65) EncryptMessage_pubkey_t;
|
typedef PB_BYTES_ARRAY_T(33) EncryptMessage_pubkey_t;
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(1024) EncryptMessage_message_t;
|
typedef PB_BYTES_ARRAY_T(1024) EncryptMessage_message_t;
|
||||||
|
|
||||||
@ -828,7 +828,7 @@ extern const pb_field_t DebugLinkLog_fields[4];
|
|||||||
#define SignMessage_size 1094
|
#define SignMessage_size 1094
|
||||||
#define VerifyMessage_size 1131
|
#define VerifyMessage_size 1131
|
||||||
#define MessageSignature_size 104
|
#define MessageSignature_size 104
|
||||||
#define EncryptMessage_size 1163
|
#define EncryptMessage_size 1131
|
||||||
#define EncryptedMessage_size 1168
|
#define EncryptedMessage_size 1168
|
||||||
#define DecryptMessage_size 1216
|
#define DecryptMessage_size 1216
|
||||||
#define DecryptedMessage_size 1064
|
#define DecryptedMessage_size 1064
|
||||||
|
@ -7,7 +7,7 @@ CoinType.coin_shortcut max_size:9
|
|||||||
|
|
||||||
TxInputType.address_n max_count:8
|
TxInputType.address_n max_count:8
|
||||||
TxInputType.prev_hash max_size:32
|
TxInputType.prev_hash max_size:32
|
||||||
TxInputType.script_sig max_size:520
|
TxInputType.script_sig max_size:1650
|
||||||
|
|
||||||
TxOutputType.address max_size:35
|
TxOutputType.address max_size:35
|
||||||
TxOutputType.address_n max_count:8
|
TxOutputType.address_n max_count:8
|
||||||
@ -20,8 +20,8 @@ TransactionType.outputs max_count:1
|
|||||||
|
|
||||||
TxRequestDetailsType.tx_hash max_size:32
|
TxRequestDetailsType.tx_hash max_size:32
|
||||||
|
|
||||||
TxRequestSerializedType.signature max_size:80
|
TxRequestSerializedType.signature max_size:73
|
||||||
TxRequestSerializedType.serialized_tx max_size:1024
|
TxRequestSerializedType.serialized_tx max_size:2048
|
||||||
|
|
||||||
MultisigRedeemScriptType.pubkeys max_count:5 max_size:65
|
MultisigRedeemScriptType.pubkeys max_count:15 max_size:33
|
||||||
MultisigRedeemScriptType.signatures max_count:4 max_size:80
|
MultisigRedeemScriptType.signatures max_count:15 max_size:73
|
||||||
|
@ -93,15 +93,15 @@ typedef struct _HDNodeType {
|
|||||||
HDNodeType_public_key_t public_key;
|
HDNodeType_public_key_t public_key;
|
||||||
} HDNodeType;
|
} HDNodeType;
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(65) MultisigRedeemScriptType_pubkeys_t;
|
typedef PB_BYTES_ARRAY_T(33) MultisigRedeemScriptType_pubkeys_t;
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(80) MultisigRedeemScriptType_signatures_t;
|
typedef PB_BYTES_ARRAY_T(73) MultisigRedeemScriptType_signatures_t;
|
||||||
|
|
||||||
typedef struct _MultisigRedeemScriptType {
|
typedef struct _MultisigRedeemScriptType {
|
||||||
pb_size_t pubkeys_count;
|
pb_size_t pubkeys_count;
|
||||||
MultisigRedeemScriptType_pubkeys_t pubkeys[5];
|
MultisigRedeemScriptType_pubkeys_t pubkeys[15];
|
||||||
pb_size_t signatures_count;
|
pb_size_t signatures_count;
|
||||||
MultisigRedeemScriptType_signatures_t signatures[4];
|
MultisigRedeemScriptType_signatures_t signatures[15];
|
||||||
bool has_m;
|
bool has_m;
|
||||||
uint32_t m;
|
uint32_t m;
|
||||||
} MultisigRedeemScriptType;
|
} MultisigRedeemScriptType;
|
||||||
@ -131,9 +131,9 @@ typedef struct _TxRequestDetailsType {
|
|||||||
TxRequestDetailsType_tx_hash_t tx_hash;
|
TxRequestDetailsType_tx_hash_t tx_hash;
|
||||||
} TxRequestDetailsType;
|
} TxRequestDetailsType;
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(80) TxRequestSerializedType_signature_t;
|
typedef PB_BYTES_ARRAY_T(73) TxRequestSerializedType_signature_t;
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(1024) TxRequestSerializedType_serialized_tx_t;
|
typedef PB_BYTES_ARRAY_T(2048) TxRequestSerializedType_serialized_tx_t;
|
||||||
|
|
||||||
typedef struct _TxRequestSerializedType {
|
typedef struct _TxRequestSerializedType {
|
||||||
bool has_signature_index;
|
bool has_signature_index;
|
||||||
@ -146,7 +146,7 @@ typedef struct _TxRequestSerializedType {
|
|||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(32) TxInputType_prev_hash_t;
|
typedef PB_BYTES_ARRAY_T(32) TxInputType_prev_hash_t;
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(520) TxInputType_script_sig_t;
|
typedef PB_BYTES_ARRAY_T(1650) TxInputType_script_sig_t;
|
||||||
|
|
||||||
typedef struct _TxInputType {
|
typedef struct _TxInputType {
|
||||||
pb_size_t address_n_count;
|
pb_size_t address_n_count;
|
||||||
@ -193,7 +193,7 @@ extern const InputScriptType TxInputType_script_type_default;
|
|||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define HDNodeType_init_default {0, 0, 0, {0, {0}}, false, {0, {0}}, false, {0, {0}}}
|
#define HDNodeType_init_default {0, 0, 0, {0, {0}}, false, {0, {0}}, false, {0, {0}}}
|
||||||
#define CoinType_init_default {false, "", false, "", false, 0, false, 0}
|
#define CoinType_init_default {false, "", false, "", false, 0, false, 0}
|
||||||
#define MultisigRedeemScriptType_init_default {0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, 0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, false, 0}
|
#define MultisigRedeemScriptType_init_default {0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, 0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, false, 0}
|
||||||
#define TxInputType_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, {0}}, 0, false, {0, {0}}, false, 4294967295u, false, InputScriptType_SPENDADDRESS, false, MultisigRedeemScriptType_init_default}
|
#define TxInputType_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, {0}}, 0, false, {0, {0}}, false, 4294967295u, false, InputScriptType_SPENDADDRESS, false, MultisigRedeemScriptType_init_default}
|
||||||
#define TxOutputType_init_default {false, "", 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, (OutputScriptType)0}
|
#define TxOutputType_init_default {false, "", 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, (OutputScriptType)0}
|
||||||
#define TxOutputBinType_init_default {0, {0, {0}}}
|
#define TxOutputBinType_init_default {0, {0, {0}}}
|
||||||
@ -202,7 +202,7 @@ extern const InputScriptType TxInputType_script_type_default;
|
|||||||
#define TxRequestSerializedType_init_default {false, 0, false, {0, {0}}, false, {0, {0}}}
|
#define TxRequestSerializedType_init_default {false, 0, false, {0, {0}}, false, {0, {0}}}
|
||||||
#define HDNodeType_init_zero {0, 0, 0, {0, {0}}, false, {0, {0}}, false, {0, {0}}}
|
#define HDNodeType_init_zero {0, 0, 0, {0, {0}}, false, {0, {0}}, false, {0, {0}}}
|
||||||
#define CoinType_init_zero {false, "", false, "", false, 0, false, 0}
|
#define CoinType_init_zero {false, "", false, "", false, 0, false, 0}
|
||||||
#define MultisigRedeemScriptType_init_zero {0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, 0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, false, 0}
|
#define MultisigRedeemScriptType_init_zero {0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, 0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, false, 0}
|
||||||
#define TxInputType_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, {0}}, 0, false, {0, {0}}, false, 0, false, (InputScriptType)0, false, MultisigRedeemScriptType_init_zero}
|
#define TxInputType_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, {0}}, 0, false, {0, {0}}, false, 0, false, (InputScriptType)0, false, MultisigRedeemScriptType_init_zero}
|
||||||
#define TxOutputType_init_zero {false, "", 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, (OutputScriptType)0}
|
#define TxOutputType_init_zero {false, "", 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, (OutputScriptType)0}
|
||||||
#define TxOutputBinType_init_zero {0, {0, {0}}}
|
#define TxOutputBinType_init_zero {0, {0, {0}}}
|
||||||
@ -268,13 +268,13 @@ extern const pb_field_t TxRequestSerializedType_fields[4];
|
|||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define HDNodeType_size 121
|
#define HDNodeType_size 121
|
||||||
#define CoinType_size 47
|
#define CoinType_size 47
|
||||||
#define MultisigRedeemScriptType_size 669
|
#define MultisigRedeemScriptType_size 1656
|
||||||
#define TxInputType_size 1295
|
#define TxInputType_size 3412
|
||||||
#define TxOutputType_size 102
|
#define TxOutputType_size 102
|
||||||
#define TxOutputBinType_size 534
|
#define TxOutputBinType_size 534
|
||||||
#define TransactionType_size 1963
|
#define TransactionType_size 4080
|
||||||
#define TxRequestDetailsType_size 40
|
#define TxRequestDetailsType_size 40
|
||||||
#define TxRequestSerializedType_size 1115
|
#define TxRequestSerializedType_size 2132
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -136,8 +136,8 @@ uint32_t compile_script_multisig(const MultisigRedeemScriptType *multisig, uint8
|
|||||||
if (!multisig->has_m) return 0;
|
if (!multisig->has_m) return 0;
|
||||||
uint32_t m = multisig->m;
|
uint32_t m = multisig->m;
|
||||||
uint32_t n = multisig->pubkeys_count;
|
uint32_t n = multisig->pubkeys_count;
|
||||||
if (m < 2 || m > 3) return 0;
|
if (m < 1 || m > 15) return 0;
|
||||||
if (n < 2 || n > 3) return 0;
|
if (n < 1 || n > 15) return 0;
|
||||||
uint32_t i, r = 0;
|
uint32_t i, r = 0;
|
||||||
if (out) {
|
if (out) {
|
||||||
out[r] = 0x50 + m; r++;
|
out[r] = 0x50 + m; r++;
|
||||||
@ -165,8 +165,8 @@ uint32_t compile_script_multisig_hash(const MultisigRedeemScriptType *multisig,
|
|||||||
if (!multisig->has_m) return 0;
|
if (!multisig->has_m) return 0;
|
||||||
uint32_t m = multisig->m;
|
uint32_t m = multisig->m;
|
||||||
uint32_t n = multisig->pubkeys_count;
|
uint32_t n = multisig->pubkeys_count;
|
||||||
if (m < 2 || m > 3) return 0;
|
if (m < 1 || m > 15) return 0;
|
||||||
if (n < 2 || n > 3) return 0;
|
if (n < 1 || n > 15) return 0;
|
||||||
|
|
||||||
SHA256_CTX ctx;
|
SHA256_CTX ctx;
|
||||||
sha256_Init(&ctx);
|
sha256_Init(&ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user