mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-17 21:22:10 +00:00
chore(legacy): remove Lisk
This commit is contained in:
parent
d33d61d84e
commit
becf5dcc53
1
legacy/firmware/.changelog.d/1765.removed
Normal file
1
legacy/firmware/.changelog.d/1765.removed
Normal file
@ -0,0 +1 @@
|
||||
Removed support for Lisk
|
@ -30,7 +30,6 @@ ifneq ($(BITCOIN_ONLY),1)
|
||||
OBJS += u2f.o
|
||||
OBJS += ethereum.o
|
||||
OBJS += ethereum_tokens.o
|
||||
OBJS += lisk.o
|
||||
OBJS += nem2.o
|
||||
OBJS += nem_mosaics.o
|
||||
OBJS += stellar.o
|
||||
@ -106,7 +105,6 @@ OBJS += protob/messages-debug.pb.o
|
||||
OBJS += protob/messages-management.pb.o
|
||||
ifneq ($(BITCOIN_ONLY),1)
|
||||
OBJS += protob/messages-ethereum.pb.o
|
||||
OBJS += protob/messages-lisk.pb.o
|
||||
OBJS += protob/messages-nem.pb.o
|
||||
OBJS += protob/messages-stellar.pb.o
|
||||
endif
|
||||
|
@ -55,7 +55,6 @@
|
||||
|
||||
#if !BITCOIN_ONLY
|
||||
#include "ethereum.h"
|
||||
#include "lisk.h"
|
||||
#include "nem.h"
|
||||
#include "nem2.h"
|
||||
#include "stellar.h"
|
||||
@ -335,7 +334,6 @@ void fsm_msgRebootToBootloader(void) {
|
||||
#if !BITCOIN_ONLY
|
||||
|
||||
#include "fsm_msg_ethereum.h"
|
||||
#include "fsm_msg_lisk.h"
|
||||
#include "fsm_msg_nem.h"
|
||||
#include "fsm_msg_stellar.h"
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "messages-crypto.pb.h"
|
||||
#include "messages-debug.pb.h"
|
||||
#include "messages-ethereum.pb.h"
|
||||
#include "messages-lisk.pb.h"
|
||||
#include "messages-management.pb.h"
|
||||
#include "messages-nem.pb.h"
|
||||
#include "messages-stellar.pb.h"
|
||||
@ -108,14 +107,6 @@ void fsm_msgEthereumTxAck(const EthereumTxAck *msg);
|
||||
void fsm_msgEthereumSignMessage(const EthereumSignMessage *msg);
|
||||
void fsm_msgEthereumVerifyMessage(const EthereumVerifyMessage *msg);
|
||||
|
||||
// lisk
|
||||
void fsm_msgLiskGetAddress(const LiskGetAddress *msg);
|
||||
void fsm_msgLiskGetPublicKey(const LiskGetPublicKey *msg);
|
||||
void fsm_msgLiskSignMessage(const LiskSignMessage *msg);
|
||||
void fsm_msgLiskVerifyMessage(const LiskVerifyMessage *msg);
|
||||
void fsm_msgLiskSignTx(LiskSignTx *msg); // not const because we mutate
|
||||
// transaction during validation
|
||||
|
||||
// nem
|
||||
void fsm_msgNEMGetAddress(
|
||||
NEMGetAddress *msg); // not const because we mutate msg->network
|
||||
|
@ -70,15 +70,14 @@ bool get_features(Features *resp) {
|
||||
resp->capabilities[0] = Capability_Capability_Bitcoin;
|
||||
resp->capabilities[1] = Capability_Capability_Crypto;
|
||||
#else
|
||||
resp->capabilities_count = 8;
|
||||
resp->capabilities_count = 7;
|
||||
resp->capabilities[0] = Capability_Capability_Bitcoin;
|
||||
resp->capabilities[1] = Capability_Capability_Bitcoin_like;
|
||||
resp->capabilities[2] = Capability_Capability_Crypto;
|
||||
resp->capabilities[3] = Capability_Capability_Ethereum;
|
||||
resp->capabilities[4] = Capability_Capability_Lisk;
|
||||
resp->capabilities[5] = Capability_Capability_NEM;
|
||||
resp->capabilities[6] = Capability_Capability_Stellar;
|
||||
resp->capabilities[7] = Capability_Capability_U2F;
|
||||
resp->capabilities[4] = Capability_Capability_NEM;
|
||||
resp->capabilities[5] = Capability_Capability_Stellar;
|
||||
resp->capabilities[6] = Capability_Capability_U2F;
|
||||
#endif
|
||||
return resp;
|
||||
}
|
||||
|
@ -1,143 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Trezor project, https://trezor.io/
|
||||
*
|
||||
* Copyright (C) 2018 alepop <alepooop@gmail.com>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
void fsm_msgLiskGetAddress(const LiskGetAddress *msg) {
|
||||
CHECK_INITIALIZED
|
||||
|
||||
CHECK_PIN
|
||||
|
||||
RESP_INIT(LiskAddress);
|
||||
|
||||
HDNode *node = fsm_getDerivedNode(ED25519_NAME, msg->address_n,
|
||||
msg->address_n_count, NULL);
|
||||
if (!node) return;
|
||||
|
||||
hdnode_fill_public_key(node);
|
||||
lisk_get_address_from_public_key(&node->public_key[1], resp->address);
|
||||
|
||||
if (msg->has_show_display && msg->show_display) {
|
||||
if (!fsm_layoutAddress(resp->address, _("Address:"), true, 0,
|
||||
msg->address_n, msg->address_n_count, false, NULL, 0,
|
||||
0, NULL)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
msg_write(MessageType_MessageType_LiskAddress, resp);
|
||||
|
||||
layoutHome();
|
||||
}
|
||||
|
||||
void fsm_msgLiskGetPublicKey(const LiskGetPublicKey *msg) {
|
||||
CHECK_INITIALIZED
|
||||
|
||||
CHECK_PIN
|
||||
|
||||
RESP_INIT(LiskPublicKey);
|
||||
|
||||
HDNode *node = fsm_getDerivedNode(ED25519_NAME, msg->address_n,
|
||||
msg->address_n_count, NULL);
|
||||
if (!node) return;
|
||||
|
||||
hdnode_fill_public_key(node);
|
||||
|
||||
resp->public_key.size = 32;
|
||||
|
||||
if (msg->has_show_display && msg->show_display) {
|
||||
layoutLiskPublicKey(&node->public_key[1]);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_PublicKey, true)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(&resp->public_key.bytes, &node->public_key[1],
|
||||
sizeof(resp->public_key.bytes));
|
||||
|
||||
msg_write(MessageType_MessageType_LiskPublicKey, resp);
|
||||
|
||||
layoutHome();
|
||||
}
|
||||
|
||||
void fsm_msgLiskSignMessage(const LiskSignMessage *msg) {
|
||||
CHECK_INITIALIZED
|
||||
|
||||
CHECK_PIN
|
||||
|
||||
RESP_INIT(LiskMessageSignature);
|
||||
|
||||
HDNode *node = fsm_getDerivedNode(ED25519_NAME, msg->address_n,
|
||||
msg->address_n_count, NULL);
|
||||
if (!node) return;
|
||||
|
||||
hdnode_fill_public_key(node);
|
||||
|
||||
lisk_sign_message(node, msg, resp);
|
||||
|
||||
msg_write(MessageType_MessageType_LiskMessageSignature, resp);
|
||||
|
||||
layoutHome();
|
||||
}
|
||||
|
||||
void fsm_msgLiskVerifyMessage(const LiskVerifyMessage *msg) {
|
||||
if (lisk_verify_message(msg)) {
|
||||
char address[MAX_LISK_ADDRESS_SIZE];
|
||||
lisk_get_address_from_public_key((const uint8_t *)&msg->public_key,
|
||||
address);
|
||||
|
||||
layoutLiskVerifyAddress(address);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_Other, false)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
layoutVerifyMessage(msg->message.bytes, msg->message.size);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_Other, false)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
fsm_sendSuccess(_("Message verified"));
|
||||
} else {
|
||||
fsm_sendFailure(FailureType_Failure_DataError, _("Invalid signature"));
|
||||
}
|
||||
|
||||
layoutHome();
|
||||
}
|
||||
|
||||
void fsm_msgLiskSignTx(LiskSignTx *msg) {
|
||||
CHECK_INITIALIZED
|
||||
|
||||
CHECK_PIN
|
||||
|
||||
RESP_INIT(LiskSignedTx);
|
||||
|
||||
HDNode *node = fsm_getDerivedNode(ED25519_NAME, msg->address_n,
|
||||
msg->address_n_count, NULL);
|
||||
if (!node) return;
|
||||
|
||||
hdnode_fill_public_key(node);
|
||||
|
||||
lisk_sign_tx(node, msg, resp);
|
||||
|
||||
msg_write(MessageType_MessageType_LiskSignedTx, resp);
|
||||
|
||||
layoutHome();
|
||||
}
|
@ -1,349 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Trezor project, https://trezor.io/
|
||||
*
|
||||
* Copyright (C) 2018 alepop <alepooop@gmail.com>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "lisk.h"
|
||||
#include "bitmaps.h"
|
||||
#include "crypto.h"
|
||||
#include "curves.h"
|
||||
#include "fsm.h"
|
||||
#include "gettext.h"
|
||||
#include "layout2.h"
|
||||
#include "messages.pb.h"
|
||||
#include "protect.h"
|
||||
#include "util.h"
|
||||
|
||||
void lisk_get_address_from_public_key(const uint8_t *public_key,
|
||||
char *address) {
|
||||
uint64_t digest[4] = {0};
|
||||
sha256_Raw(public_key, 32, (uint8_t *)digest);
|
||||
bn_format_uint64(digest[0], NULL, "L", 0, 0, false, address,
|
||||
MAX_LISK_ADDRESS_SIZE);
|
||||
}
|
||||
|
||||
void lisk_message_hash(const uint8_t *message, size_t message_len,
|
||||
uint8_t hash[32]) {
|
||||
SHA256_CTX ctx = {0};
|
||||
sha256_Init(&ctx);
|
||||
sha256_Update(&ctx, (const uint8_t *)"\x15" "Lisk Signed Message:\n", 22);
|
||||
uint8_t varint[5] = {0};
|
||||
uint32_t l = ser_length(message_len, varint);
|
||||
sha256_Update(&ctx, varint, l);
|
||||
sha256_Update(&ctx, message, message_len);
|
||||
sha256_Final(&ctx, hash);
|
||||
sha256_Raw(hash, 32, hash);
|
||||
}
|
||||
|
||||
void lisk_sign_message(const HDNode *node, const LiskSignMessage *msg,
|
||||
LiskMessageSignature *resp) {
|
||||
layoutSignMessage(msg->message.bytes, msg->message.size);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_ProtectCall, false)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
|
||||
layoutProgressSwipe(_("Signing"), 0);
|
||||
|
||||
uint8_t signature[64] = {0};
|
||||
uint8_t hash[32] = {0};
|
||||
lisk_message_hash(msg->message.bytes, msg->message.size, hash);
|
||||
|
||||
ed25519_sign(hash, 32, node->private_key, &node->public_key[1], signature);
|
||||
|
||||
memcpy(resp->signature.bytes, signature, sizeof(signature));
|
||||
memcpy(resp->public_key.bytes, &node->public_key[1], 32);
|
||||
|
||||
resp->signature.size = 64;
|
||||
resp->public_key.size = 32;
|
||||
}
|
||||
|
||||
bool lisk_verify_message(const LiskVerifyMessage *msg) {
|
||||
uint8_t hash[32] = {0};
|
||||
lisk_message_hash(msg->message.bytes, msg->message.size, hash);
|
||||
return 0 == ed25519_sign_open(hash, 32, msg->public_key.bytes,
|
||||
msg->signature.bytes);
|
||||
}
|
||||
|
||||
static void lisk_update_raw_tx(const HDNode *node, LiskSignTx *msg) {
|
||||
if (!msg->transaction.has_sender_public_key) {
|
||||
memcpy(msg->transaction.sender_public_key.bytes, &node->public_key[1], 32);
|
||||
}
|
||||
|
||||
// For CastVotes transactions, recipientId should be equal to transaction
|
||||
// creator address.
|
||||
if (msg->transaction.type == LiskTransactionType_CastVotes &&
|
||||
!msg->transaction.has_recipient_id) {
|
||||
msg->transaction.has_recipient_id = true;
|
||||
lisk_get_address_from_public_key(&node->public_key[1],
|
||||
msg->transaction.recipient_id);
|
||||
}
|
||||
}
|
||||
|
||||
static void lisk_hashupdate_uint32(SHA256_CTX *ctx, uint32_t value) {
|
||||
uint8_t data[4] = {0};
|
||||
write_le(data, value);
|
||||
sha256_Update(ctx, data, sizeof(data));
|
||||
}
|
||||
|
||||
static void lisk_hashupdate_uint64_le(SHA256_CTX *ctx, uint64_t value) {
|
||||
sha256_Update(ctx, (uint8_t *)&value, sizeof(uint64_t));
|
||||
}
|
||||
|
||||
static void lisk_hashupdate_uint64_be(SHA256_CTX *ctx, uint64_t value) {
|
||||
uint8_t data[8] = {0};
|
||||
data[0] = value >> 56;
|
||||
data[1] = value >> 48;
|
||||
data[2] = value >> 40;
|
||||
data[3] = value >> 32;
|
||||
data[4] = value >> 24;
|
||||
data[5] = value >> 16;
|
||||
data[6] = value >> 8;
|
||||
data[7] = value;
|
||||
sha256_Update(ctx, data, sizeof(data));
|
||||
}
|
||||
|
||||
static void lisk_hashupdate_asset(SHA256_CTX *ctx, LiskTransactionType type,
|
||||
LiskTransactionAsset *asset) {
|
||||
switch (type) {
|
||||
case LiskTransactionType_Transfer:
|
||||
if (asset->has_data) {
|
||||
sha256_Update(ctx, (const uint8_t *)asset->data, strlen(asset->data));
|
||||
}
|
||||
break;
|
||||
case LiskTransactionType_RegisterDelegate:
|
||||
if (asset->has_delegate && asset->delegate.has_username) {
|
||||
sha256_Update(ctx, (const uint8_t *)asset->delegate.username,
|
||||
strlen(asset->delegate.username));
|
||||
}
|
||||
break;
|
||||
case LiskTransactionType_CastVotes: {
|
||||
for (int i = 0; i < asset->votes_count; i++) {
|
||||
sha256_Update(ctx, (uint8_t *)asset->votes[i], strlen(asset->votes[i]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LiskTransactionType_RegisterSecondPassphrase:
|
||||
if (asset->has_signature && asset->signature.has_public_key) {
|
||||
sha256_Update(ctx, asset->signature.public_key.bytes,
|
||||
asset->signature.public_key.size);
|
||||
}
|
||||
break;
|
||||
case LiskTransactionType_RegisterMultisignatureAccount:
|
||||
if (asset->has_multisignature) {
|
||||
sha256_Update(ctx, (uint8_t *)&(asset->multisignature.min), 1);
|
||||
sha256_Update(ctx, (uint8_t *)&(asset->multisignature.life_time), 1);
|
||||
for (int i = 0; i < asset->multisignature.keys_group_count; i++) {
|
||||
sha256_Update(ctx, (uint8_t *)asset->multisignature.keys_group[i],
|
||||
strlen(asset->multisignature.keys_group[i]));
|
||||
};
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fsm_sendFailure(FailureType_Failure_DataError,
|
||||
_("Invalid transaction type"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#define MAX_LISK_VALUE_SIZE 20
|
||||
|
||||
static void lisk_format_value(uint64_t value, char *formated_value) {
|
||||
bn_format_uint64(value, NULL, " LSK", 8, 0, false, formated_value,
|
||||
MAX_LISK_VALUE_SIZE);
|
||||
}
|
||||
|
||||
void lisk_sign_tx(const HDNode *node, LiskSignTx *msg, LiskSignedTx *resp) {
|
||||
lisk_update_raw_tx(node, msg);
|
||||
|
||||
SHA256_CTX ctx = {0};
|
||||
sha256_Init(&ctx);
|
||||
|
||||
switch (msg->transaction.type) {
|
||||
case LiskTransactionType_Transfer:
|
||||
layoutRequireConfirmTx(msg->transaction.recipient_id,
|
||||
msg->transaction.amount);
|
||||
break;
|
||||
case LiskTransactionType_RegisterDelegate:
|
||||
layoutRequireConfirmDelegateRegistration(&msg->transaction.asset);
|
||||
break;
|
||||
case LiskTransactionType_CastVotes:
|
||||
layoutRequireConfirmCastVotes(&msg->transaction.asset);
|
||||
break;
|
||||
case LiskTransactionType_RegisterSecondPassphrase:
|
||||
layoutLiskPublicKey(msg->transaction.asset.signature.public_key.bytes);
|
||||
break;
|
||||
case LiskTransactionType_RegisterMultisignatureAccount:
|
||||
layoutRequireConfirmMultisig(&msg->transaction.asset);
|
||||
break;
|
||||
default:
|
||||
fsm_sendFailure(FailureType_Failure_DataError,
|
||||
_("Invalid transaction type"));
|
||||
layoutHome();
|
||||
break;
|
||||
}
|
||||
if (!protectButton(
|
||||
(msg->transaction.type == LiskTransactionType_RegisterSecondPassphrase
|
||||
? ButtonRequestType_ButtonRequest_PublicKey
|
||||
: ButtonRequestType_ButtonRequest_SignTx),
|
||||
false)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, "Signing cancelled");
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
|
||||
layoutRequireConfirmFee(msg->transaction.fee, msg->transaction.amount);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_ConfirmOutput, false)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, "Signing cancelled");
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
layoutProgressSwipe(_("Signing transaction"), 0);
|
||||
|
||||
sha256_Update(&ctx, (const uint8_t *)&msg->transaction.type, 1);
|
||||
|
||||
lisk_hashupdate_uint32(&ctx, msg->transaction.timestamp);
|
||||
|
||||
sha256_Update(&ctx, msg->transaction.sender_public_key.bytes, 32);
|
||||
|
||||
if (msg->transaction.has_requester_public_key) {
|
||||
sha256_Update(&ctx, msg->transaction.requester_public_key.bytes,
|
||||
msg->transaction.requester_public_key.size);
|
||||
}
|
||||
|
||||
uint64_t recipient_id = 0;
|
||||
if (msg->transaction.has_recipient_id &&
|
||||
msg->transaction.recipient_id[0] != 0) {
|
||||
// parse integer from lisk address ("123L" -> 123)
|
||||
for (size_t i = 0; i < strlen(msg->transaction.recipient_id) - 1; i++) {
|
||||
if (msg->transaction.recipient_id[i] < '0' ||
|
||||
msg->transaction.recipient_id[i] > '9') {
|
||||
fsm_sendFailure(FailureType_Failure_DataError,
|
||||
_("Invalid recipient_id"));
|
||||
layoutHome();
|
||||
return;
|
||||
}
|
||||
recipient_id *= 10;
|
||||
recipient_id += (msg->transaction.recipient_id[i] - '0');
|
||||
}
|
||||
}
|
||||
lisk_hashupdate_uint64_be(&ctx, recipient_id);
|
||||
lisk_hashupdate_uint64_le(&ctx, msg->transaction.amount);
|
||||
|
||||
lisk_hashupdate_asset(&ctx, msg->transaction.type, &msg->transaction.asset);
|
||||
|
||||
// if signature exist calculate second signature
|
||||
if (msg->transaction.has_signature) {
|
||||
sha256_Update(&ctx, msg->transaction.signature.bytes,
|
||||
msg->transaction.signature.size);
|
||||
}
|
||||
|
||||
uint8_t hash[32] = {0};
|
||||
sha256_Final(&ctx, hash);
|
||||
ed25519_sign(hash, 32, node->private_key, &node->public_key[1],
|
||||
resp->signature.bytes);
|
||||
|
||||
resp->signature.size = 64;
|
||||
}
|
||||
|
||||
// Layouts
|
||||
void layoutLiskPublicKey(const uint8_t *pubkey) {
|
||||
const char **str = split_message_hex(pubkey, 32);
|
||||
layoutDialogSwipe(&bmp_icon_question, NULL, _("Continue"), NULL,
|
||||
_("Public Key:"), str[0], str[1], str[2], str[3], NULL);
|
||||
}
|
||||
|
||||
void layoutLiskVerifyAddress(const char *address) {
|
||||
const char **str =
|
||||
split_message((const uint8_t *)address, strlen(address), 10);
|
||||
layoutDialogSwipe(&bmp_icon_info, _("Cancel"), _("Confirm"),
|
||||
_("Confirm address?"), _("Message signed by:"), str[0],
|
||||
str[1], NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void layoutRequireConfirmTx(char *recipient_id, uint64_t amount) {
|
||||
char formated_amount[MAX_LISK_VALUE_SIZE] = {0};
|
||||
const char **str =
|
||||
split_message((const uint8_t *)recipient_id, strlen(recipient_id), 16);
|
||||
lisk_format_value(amount, formated_amount);
|
||||
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
|
||||
_("Confirm sending"), formated_amount, _("to:"), str[0],
|
||||
str[1], NULL);
|
||||
}
|
||||
|
||||
void layoutRequireConfirmFee(uint64_t fee, uint64_t amount) {
|
||||
char formated_amount[MAX_LISK_VALUE_SIZE] = {0};
|
||||
char formated_fee[MAX_LISK_VALUE_SIZE] = {0};
|
||||
lisk_format_value(amount, formated_amount);
|
||||
lisk_format_value(fee, formated_fee);
|
||||
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
|
||||
_("Confirm transaction"), formated_amount, _("fee:"),
|
||||
formated_fee, NULL, NULL);
|
||||
}
|
||||
|
||||
void layoutRequireConfirmDelegateRegistration(LiskTransactionAsset *asset) {
|
||||
if (asset->has_delegate && asset->delegate.has_username) {
|
||||
const char **str = split_message((const uint8_t *)asset->delegate.username,
|
||||
strlen(asset->delegate.username), 20);
|
||||
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
|
||||
_("Confirm transaction"), _("Do you really want to"),
|
||||
_("register a delegate?"), str[0], str[1], NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void layoutRequireConfirmCastVotes(LiskTransactionAsset *asset) {
|
||||
uint8_t plus = 0;
|
||||
uint8_t minus = 0;
|
||||
char add_votes_txt[13] = {0};
|
||||
char remove_votes_txt[16] = {0};
|
||||
|
||||
for (int i = 0; i < asset->votes_count; i++) {
|
||||
if (asset->votes[i][0] == '+') {
|
||||
plus += 1;
|
||||
} else {
|
||||
minus += 1;
|
||||
}
|
||||
}
|
||||
|
||||
bn_format_uint64(plus, "Add ", NULL, 0, 0, false, add_votes_txt,
|
||||
sizeof(add_votes_txt));
|
||||
bn_format_uint64(minus, "Remove ", NULL, 0, 0, false, remove_votes_txt,
|
||||
sizeof(remove_votes_txt));
|
||||
|
||||
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
|
||||
_("Confirm transaction"), add_votes_txt, remove_votes_txt,
|
||||
NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void layoutRequireConfirmMultisig(LiskTransactionAsset *asset) {
|
||||
char keys_group_str[25] = {0};
|
||||
char life_time_str[14] = {0};
|
||||
char min_str[8] = {0};
|
||||
|
||||
bn_format_uint64(asset->multisignature.keys_group_count,
|
||||
"Keys group length: ", NULL, 0, 0, false, keys_group_str,
|
||||
sizeof(keys_group_str));
|
||||
bn_format_uint64(asset->multisignature.life_time, "Life time: ", NULL, 0, 0,
|
||||
false, life_time_str, sizeof(life_time_str));
|
||||
bn_format_uint64(asset->multisignature.min, "Min: ", NULL, 0, 0, false,
|
||||
min_str, sizeof(min_str));
|
||||
|
||||
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
|
||||
_("Confirm transaction"), keys_group_str, life_time_str,
|
||||
min_str, NULL, NULL);
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Trezor project, https://trezor.io/
|
||||
*
|
||||
* Copyright (C) 2018 alepop <alepooop@gmail.com>
|
||||
*
|
||||
* This library is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __LISK_H__
|
||||
#define __LISK_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "bip32.h"
|
||||
#include "messages-lisk.pb.h"
|
||||
|
||||
#define MAX_LISK_ADDRESS_SIZE 23
|
||||
|
||||
void lisk_sign_message(const HDNode *node, const LiskSignMessage *msg,
|
||||
LiskMessageSignature *resp);
|
||||
bool lisk_verify_message(const LiskVerifyMessage *msg);
|
||||
void lisk_sign_tx(const HDNode *node, LiskSignTx *msg, LiskSignedTx *resp);
|
||||
|
||||
// Helpers
|
||||
void lisk_get_address_from_public_key(const uint8_t *public_key, char *address);
|
||||
|
||||
// Layout
|
||||
void layoutLiskPublicKey(const uint8_t *pubkey);
|
||||
void layoutLiskVerifyAddress(const char *address);
|
||||
void layoutRequireConfirmTx(char *recipient_id, uint64_t amount);
|
||||
void layoutRequireConfirmDelegateRegistration(LiskTransactionAsset *asset);
|
||||
void layoutRequireConfirmCastVotes(LiskTransactionAsset *asset);
|
||||
void layoutRequireConfirmMultisig(LiskTransactionAsset *asset);
|
||||
void layoutRequireConfirmFee(uint64_t fee, uint64_t amount);
|
||||
|
||||
#endif
|
@ -9,11 +9,11 @@ SKIPPED_MESSAGES := Binance Cardano DebugMonero Eos Monero Ontology Ripple SdPro
|
||||
TxAckInput TxAckOutput TxAckPrev
|
||||
|
||||
ifeq ($(BITCOIN_ONLY), 1)
|
||||
SKIPPED_MESSAGES += Ethereum Lisk NEM Stellar
|
||||
SKIPPED_MESSAGES += Ethereum NEM Stellar
|
||||
endif
|
||||
|
||||
PROTO_NAMES = messages messages-bitcoin messages-common messages-crypto messages-debug \
|
||||
messages-ethereum messages-lisk messages-management messages-nem messages-stellar
|
||||
messages-ethereum messages-management messages-nem messages-stellar
|
||||
|
||||
PROTO_OPTIONS = $(PROTO_NAMES:=.options)
|
||||
PROTO_COMPILED = $(PROTO_NAMES:=.pb)
|
||||
|
@ -1,30 +0,0 @@
|
||||
LiskGetAddress.address_n max_count:8
|
||||
LiskAddress.address max_size:23
|
||||
|
||||
LiskGetPublicKey.address_n max_count:8
|
||||
LiskPublicKey.public_key max_size:32
|
||||
|
||||
LiskSignMessage.address_n max_count:8
|
||||
LiskSignMessage.message max_size:1024
|
||||
LiskMessageSignature.public_key max_size:32
|
||||
LiskMessageSignature.signature max_size:64
|
||||
|
||||
LiskVerifyMessage.public_key max_size:33
|
||||
LiskVerifyMessage.message max_size:1024
|
||||
LiskVerifyMessage.signature max_size:65
|
||||
|
||||
LiskSignTx.address_n max_count:8
|
||||
|
||||
LiskSignedTx.signature max_size:64
|
||||
|
||||
LiskTransactionCommon.recipient_id max_size:23
|
||||
LiskTransactionCommon.sender_public_key max_size:32
|
||||
LiskTransactionCommon.requester_public_key max_size:32
|
||||
LiskTransactionCommon.signature max_size:64
|
||||
|
||||
LiskTransactionAsset.data max_size:64
|
||||
LiskTransactionAsset.votes max_count:33 max_size:66
|
||||
|
||||
LiskSignatureType.public_key max_size:32
|
||||
LiskDelegateType.username max_size:20
|
||||
LiskMultisignatureType.keys_group max_count:10 max_size:66
|
@ -1 +0,0 @@
|
||||
../../vendor/trezor-common/protob/messages-lisk.proto
|
Loading…
Reference in New Issue
Block a user