mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 20:11:00 +00:00
add description to layoutAddress
This commit is contained in:
parent
f2f50aa188
commit
2f5e520345
@ -308,6 +308,7 @@ int cryptoMultisigFingerprint(const MultisigRedeemScriptType *multisig, uint8_t
|
||||
}
|
||||
uint32_t i, j;
|
||||
// check sanity
|
||||
if (!multisig->has_m || multisig->m < 1 || multisig->m > 15) return 0;
|
||||
for (i = 0; i < n; i++) {
|
||||
ptr[i] = &(multisig->pubkeys[i]);
|
||||
if (!ptr[i]->node.has_public_key || ptr[i]->node.public_key.size != 33) return 0;
|
||||
@ -326,6 +327,7 @@ int cryptoMultisigFingerprint(const MultisigRedeemScriptType *multisig, uint8_t
|
||||
// hash sorted nodes
|
||||
SHA256_CTX ctx;
|
||||
sha256_Init(&ctx);
|
||||
sha256_Update(&ctx, (const uint8_t *)&(multisig->m), sizeof(uint32_t));
|
||||
for (i = 0; i < n; i++) {
|
||||
sha256_Update(&ctx, (const uint8_t *)&(ptr[i]->node.depth), sizeof(uint32_t));
|
||||
sha256_Update(&ctx, (const uint8_t *)&(ptr[i]->node.fingerprint), sizeof(uint32_t));
|
||||
@ -333,6 +335,7 @@ int cryptoMultisigFingerprint(const MultisigRedeemScriptType *multisig, uint8_t
|
||||
sha256_Update(&ctx, ptr[i]->node.chain_code.bytes, 32);
|
||||
sha256_Update(&ctx, ptr[i]->node.public_key.bytes, 33);
|
||||
}
|
||||
sha256_Update(&ctx, (const uint8_t *)&n, sizeof(uint32_t));
|
||||
sha256_Final(hash, &ctx);
|
||||
layoutProgressUpdate(true);
|
||||
return 1;
|
||||
|
@ -526,7 +526,19 @@ void fsm_msgGetAddress(GetAddress *msg)
|
||||
}
|
||||
|
||||
if (msg->has_show_display && msg->show_display) {
|
||||
layoutAddress(resp->address);
|
||||
char desc[16];
|
||||
if (msg->has_multisig) {
|
||||
strlcpy(desc, "Msig __ of __:", sizeof(desc));
|
||||
const uint32_t m = msg->multisig.m;
|
||||
const uint32_t n = msg->multisig.pubkeys_count;
|
||||
desc[5] = (m < 10) ? ' ': ('0' + (m / 10));
|
||||
desc[6] = '0' + (m % 10);
|
||||
desc[11] = (n < 10) ? ' ': ('0' + (n / 10));
|
||||
desc[12] = '0' + (n % 10);
|
||||
} else {
|
||||
strlcpy(desc, "Address:", sizeof(desc));
|
||||
}
|
||||
layoutAddress(resp->address, desc);
|
||||
if (!protectButton(ButtonRequestType_ButtonRequest_Address, true)) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, "Show address cancelled");
|
||||
layoutHome();
|
||||
|
@ -220,7 +220,7 @@ void layoutDecryptMessage(const uint8_t *msg, uint32_t len, const char *address)
|
||||
str[0], str[1], str[2], str[3], NULL, NULL);
|
||||
}
|
||||
|
||||
void layoutAddress(const char *address)
|
||||
void layoutAddress(const char *address, const char *desc)
|
||||
{
|
||||
oledSwipeLeft();
|
||||
layoutLast = layoutAddress;
|
||||
@ -246,10 +246,13 @@ void layoutAddress(const char *address)
|
||||
|
||||
const char **str = split_message((const uint8_t *)address, strlen(address), 9);
|
||||
|
||||
oledDrawString(68, 0 * 9, str[0]);
|
||||
oledDrawString(68, 1 * 9, str[1]);
|
||||
oledDrawString(68, 2 * 9, str[2]);
|
||||
oledDrawString(68, 3 * 9, str[3]);
|
||||
if (desc) {
|
||||
oledDrawString(68, 0 * 9, desc);
|
||||
}
|
||||
oledDrawString(68, 1 * 9 + 4, str[0]);
|
||||
oledDrawString(68, 2 * 9 + 4, str[1]);
|
||||
oledDrawString(68, 3 * 9 + 4, str[2]);
|
||||
oledDrawString(68, 4 * 9 + 4, str[3]);
|
||||
|
||||
static const char *btnYes = "Continue";
|
||||
oledDrawString(OLED_WIDTH - fontCharWidth('\x06') - 1, OLED_HEIGHT - 8, "\x06");
|
||||
|
@ -35,6 +35,6 @@ 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);
|
||||
void layoutDecryptMessage(const uint8_t *msg, uint32_t len, const char *address);
|
||||
void layoutAddress(const char *address);
|
||||
void layoutAddress(const char *address, const char *desc);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user