1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-14 03:30:02 +00:00

show address in verifymessage layout

This commit is contained in:
Pavol Rusnak 2016-04-25 23:03:57 +02:00
parent 51f02ff763
commit 9e8c369f93
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 21 additions and 2 deletions

View File

@ -673,8 +673,18 @@ void fsm_msgVerifyMessage(VerifyMessage *msg)
fsm_sendFailure(FailureType_Failure_InvalidSignature, "Invalid address");
}
if (msg->signature.size == 65 && cryptoMessageVerify(msg->message.bytes, msg->message.size, addr_raw, msg->signature.bytes) == 0) {
layoutVerifyAddress(msg->address);
if (!protectButton(ButtonRequestType_ButtonRequest_Address, false)) {
fsm_sendFailure(FailureType_Failure_ActionCancelled, "Message verification cancelled");
layoutHome();
return;
}
layoutVerifyMessage(msg->message.bytes, msg->message.size);
protectButton(ButtonRequestType_ButtonRequest_Other, true);
if (!protectButton(ButtonRequestType_ButtonRequest_Other, false)) {
fsm_sendFailure(FailureType_Failure_ActionCancelled, "Message verification cancelled");
layoutHome();
return;
}
fsm_sendSuccess("Message verified");
} else {
fsm_sendFailure(FailureType_Failure_InvalidSignature, "Invalid signature");

View File

@ -196,10 +196,18 @@ void layoutSignMessage(const uint8_t *msg, uint32_t len)
str[0], str[1], str[2], str[3], NULL, NULL);
}
void layoutVerifyAddress(const char *address)
{
const char **str = split_message((const uint8_t *)address, strlen(address), 17);
layoutDialogSwipe(DIALOG_ICON_INFO, "Cancel", "Confirm",
"Address from signature:",
NULL, str[0], str[1], str[2], NULL, NULL);
}
void layoutVerifyMessage(const uint8_t *msg, uint32_t len)
{
const char **str = split_message(msg, len, 16);
layoutDialogSwipe(DIALOG_ICON_INFO, NULL, "OK",
layoutDialogSwipe(DIALOG_ICON_INFO, "Cancel", "Confirm",
"Verified message",
str[0], str[1], str[2], str[3], NULL, NULL);
}

View File

@ -32,6 +32,7 @@ void layoutConfirmOutput(const CoinType *coin, const TxOutputType *out);
void layoutConfirmTx(const CoinType *coin, uint64_t amount_out, uint64_t amount_fee);
void layoutFeeOverThreshold(const CoinType *coin, uint64_t fee, uint32_t kb);
void layoutSignMessage(const uint8_t *msg, uint32_t len);
void layoutVerifyAddress(const char *address);
void layoutVerifyMessage(const uint8_t *msg, uint32_t len);
void layoutCipherKeyValue(bool encrypt, const char *key);
void layoutEncryptMessage(const uint8_t *msg, uint32_t len, bool signing);