From 4a0a4d72fb94b40a43d5e5729352277392780fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Vejpustek?= Date: Wed, 13 Nov 2024 15:06:22 +0100 Subject: [PATCH] feat(legacy): do not support sortedmulti on legacy [no changelog] --- legacy/firmware/transaction.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/legacy/firmware/transaction.c b/legacy/firmware/transaction.c index a259d74cc7..ab06361b86 100644 --- a/legacy/firmware/transaction.c +++ b/legacy/firmware/transaction.c @@ -25,6 +25,8 @@ #include "crypto.h" #include "debug.h" #include "ecdsa.h" +#include "fsm.h" +#include "gettext.h" #include "layout2.h" #include "memzero.h" #include "messages.pb.h" @@ -367,6 +369,7 @@ uint32_t compile_script_multisig(const CoinInfo *coin, if (m < 1 || m > 15) return 0; if (n < 1 || n > 15) return 0; uint32_t r = 0; + // TODO if (out) { out[r] = 0x50 + m; r++; @@ -391,6 +394,11 @@ 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->pubkeys_order != MultisigPubkeysOrder_PRESERVED) { + fsm_sendFailure(FailureType_Failure_DataError, + _("Sortedmulti is not supported")); + } + const uint32_t m = multisig->m; const uint32_t n = cryptoMultisigPubkeyCount(multisig); if (m < 1 || m > 15) return 0; @@ -436,6 +444,10 @@ uint32_t serialize_script_sig(const uint8_t *signature, uint32_t signature_len, uint32_t serialize_script_multisig(const CoinInfo *coin, const MultisigRedeemScriptType *multisig, uint8_t sighash, uint8_t *out) { + if (multisig->pubkeys_order != MultisigPubkeysOrder_PRESERVED) { + fsm_sendFailure(FailureType_Failure_DataError, + _("Sortedmulti is not supported")); + } uint32_t r = 0; #if !BITCOIN_ONLY if (!coin->decred) {