|
|
@ -151,6 +151,32 @@ void fsm_msgTxAck(TxAck *msg) {
|
|
|
|
signing_txack(&(msg->tx));
|
|
|
|
signing_txack(&(msg->tx));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool fsm_checkCoinPath(const CoinInfo *coin, InputScriptType script_type,
|
|
|
|
|
|
|
|
uint32_t address_n_count,
|
|
|
|
|
|
|
|
const uint32_t *address_n, bool has_multisig) {
|
|
|
|
|
|
|
|
if (!coin_path_check(coin, script_type, address_n_count, address_n,
|
|
|
|
|
|
|
|
has_multisig, CoinPathCheckLevel_SCRIPT_TYPE)) {
|
|
|
|
|
|
|
|
if (config_getSafetyCheckLevel() == SafetyCheckLevel_Strict &&
|
|
|
|
|
|
|
|
!coin_path_check(coin, script_type, address_n_count, address_n,
|
|
|
|
|
|
|
|
has_multisig, CoinPathCheckLevel_KNOWN)) {
|
|
|
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_DataError, _("Forbidden key path"));
|
|
|
|
|
|
|
|
layoutHome();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
layoutDialogSwipe(&bmp_icon_warning, _("Abort"), _("Continue"), NULL,
|
|
|
|
|
|
|
|
_("Wrong address path"), _("for selected coin."), NULL,
|
|
|
|
|
|
|
|
_("Continue at your"), _("own risk!"), NULL);
|
|
|
|
|
|
|
|
if (!protectButton(ButtonRequestType_ButtonRequest_UnknownDerivationPath,
|
|
|
|
|
|
|
|
false)) {
|
|
|
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
|
|
|
|
|
|
|
layoutHome();
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void fsm_msgGetAddress(const GetAddress *msg) {
|
|
|
|
void fsm_msgGetAddress(const GetAddress *msg) {
|
|
|
|
RESP_INIT(Address);
|
|
|
|
RESP_INIT(Address);
|
|
|
|
|
|
|
|
|
|
|
@ -199,28 +225,10 @@ void fsm_msgGetAddress(const GetAddress *msg) {
|
|
|
|
strlcpy(desc, _("Address:"), sizeof(desc));
|
|
|
|
strlcpy(desc, _("Address:"), sizeof(desc));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!coin_path_check(coin, msg->script_type, msg->address_n_count,
|
|
|
|
if (!fsm_checkCoinPath(coin, msg->script_type, msg->address_n_count,
|
|
|
|
msg->address_n, msg->has_multisig,
|
|
|
|
msg->address_n, msg->has_multisig)) {
|
|
|
|
CoinPathCheckLevel_SCRIPT_TYPE)) {
|
|
|
|
|
|
|
|
if (config_getSafetyCheckLevel() == SafetyCheckLevel_Strict &&
|
|
|
|
|
|
|
|
!coin_path_check(coin, msg->script_type, msg->address_n_count,
|
|
|
|
|
|
|
|
msg->address_n, msg->has_multisig,
|
|
|
|
|
|
|
|
CoinPathCheckLevel_KNOWN)) {
|
|
|
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_DataError, _("Forbidden key path"));
|
|
|
|
|
|
|
|
layoutHome();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
layoutDialogSwipe(&bmp_icon_warning, _("Abort"), _("Continue"), NULL,
|
|
|
|
|
|
|
|
_("Wrong address path"), _("for selected coin."), NULL,
|
|
|
|
|
|
|
|
_("Continue at your"), _("own risk!"), NULL);
|
|
|
|
|
|
|
|
if (!protectButton(ButtonRequestType_ButtonRequest_UnknownDerivationPath,
|
|
|
|
|
|
|
|
false)) {
|
|
|
|
|
|
|
|
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
|
|
|
|
|
|
|
layoutHome();
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t multisig_xpub_magic = coin->xpub_magic;
|
|
|
|
uint32_t multisig_xpub_magic = coin->xpub_magic;
|
|
|
|
if (msg->has_multisig && coin->has_segwit) {
|
|
|
|
if (msg->has_multisig && coin->has_segwit) {
|
|
|
@ -264,6 +272,12 @@ void fsm_msgSignMessage(const SignMessage *msg) {
|
|
|
|
|
|
|
|
|
|
|
|
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
|
|
|
|
const CoinInfo *coin = fsm_getCoin(msg->has_coin_name, msg->coin_name);
|
|
|
|
if (!coin) return;
|
|
|
|
if (!coin) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!fsm_checkCoinPath(coin, msg->script_type, msg->address_n_count,
|
|
|
|
|
|
|
|
msg->address_n, false)) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HDNode *node = fsm_getDerivedNode(coin->curve_name, msg->address_n,
|
|
|
|
HDNode *node = fsm_getDerivedNode(coin->curve_name, msg->address_n,
|
|
|
|
msg->address_n_count, NULL);
|
|
|
|
msg->address_n_count, NULL);
|
|
|
|
if (!node) return;
|
|
|
|
if (!node) return;
|
|
|
|