mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-27 16:48:09 +00:00
implement GetPublicKey.show_display option
This commit is contained in:
parent
27183323a4
commit
f557e6149d
@ -306,6 +306,15 @@ void fsm_msgGetPublicKey(GetPublicKey *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (msg->has_show_display && msg->show_display) {
|
||||||
|
layoutPublicKey(public_key);
|
||||||
|
if (!protectButton(ButtonRequestType_ButtonRequest_PublicKey, true)) {
|
||||||
|
fsm_sendFailure(FailureType_Failure_ActionCancelled, "Show public key cancelled");
|
||||||
|
layoutHome();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resp->node.depth = node->depth;
|
resp->node.depth = node->depth;
|
||||||
resp->node.fingerprint = node->fingerprint;
|
resp->node.fingerprint = node->fingerprint;
|
||||||
resp->node.child_num = node->child_num;
|
resp->node.child_num = node->child_num;
|
||||||
|
@ -270,6 +270,17 @@ void layoutAddress(const char *address, const char *desc)
|
|||||||
oledRefresh();
|
oledRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void layoutPublicKey(const uint8_t *pubkey)
|
||||||
|
{
|
||||||
|
char hex[32*2+1], desc[16];
|
||||||
|
strlcpy(desc, "Public Key: 00", sizeof(desc));
|
||||||
|
data2hex(pubkey, 1, desc + 12);
|
||||||
|
data2hex(pubkey + 1, 32, hex);
|
||||||
|
const char **str = split_message((const uint8_t *)hex, 32*2, 16);
|
||||||
|
layoutDialogSwipe(DIALOG_ICON_QUESTION, NULL, "Continue", NULL,
|
||||||
|
desc, str[0], str[1], str[2], str[3], NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void layoutSignIdentity(const IdentityType *identity, const char *challenge)
|
void layoutSignIdentity(const IdentityType *identity, const char *challenge)
|
||||||
{
|
{
|
||||||
char row_proto[8 + 11 + 1];
|
char row_proto[8 + 11 + 1];
|
||||||
|
@ -37,6 +37,7 @@ void layoutCipherKeyValue(bool encrypt, const char *key);
|
|||||||
void layoutEncryptMessage(const uint8_t *msg, uint32_t len, bool signing);
|
void layoutEncryptMessage(const uint8_t *msg, uint32_t len, bool signing);
|
||||||
void layoutDecryptMessage(const uint8_t *msg, uint32_t len, const char *address);
|
void layoutDecryptMessage(const uint8_t *msg, uint32_t len, const char *address);
|
||||||
void layoutAddress(const char *address, const char *desc);
|
void layoutAddress(const char *address, const char *desc);
|
||||||
|
void layoutPublicKey(const uint8_t *pubkey);
|
||||||
void layoutSignIdentity(const IdentityType *identity, const char *challenge);
|
void layoutSignIdentity(const IdentityType *identity, const char *challenge);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -123,9 +123,10 @@ const pb_field_t Entropy_fields[2] = {
|
|||||||
PB_LAST_FIELD
|
PB_LAST_FIELD
|
||||||
};
|
};
|
||||||
|
|
||||||
const pb_field_t GetPublicKey_fields[3] = {
|
const pb_field_t GetPublicKey_fields[4] = {
|
||||||
PB_FIELD2( 1, UINT32 , REPEATED, STATIC , FIRST, GetPublicKey, address_n, address_n, 0),
|
PB_FIELD2( 1, UINT32 , REPEATED, STATIC , FIRST, GetPublicKey, address_n, address_n, 0),
|
||||||
PB_FIELD2( 2, STRING , OPTIONAL, STATIC , OTHER, GetPublicKey, ecdsa_curve_name, address_n, 0),
|
PB_FIELD2( 2, STRING , OPTIONAL, STATIC , OTHER, GetPublicKey, ecdsa_curve_name, address_n, 0),
|
||||||
|
PB_FIELD2( 3, BOOL , OPTIONAL, STATIC , OTHER, GetPublicKey, show_display, ecdsa_curve_name, 0),
|
||||||
PB_LAST_FIELD
|
PB_LAST_FIELD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -426,6 +426,8 @@ typedef struct _GetPublicKey {
|
|||||||
uint32_t address_n[8];
|
uint32_t address_n[8];
|
||||||
bool has_ecdsa_curve_name;
|
bool has_ecdsa_curve_name;
|
||||||
char ecdsa_curve_name[32];
|
char ecdsa_curve_name[32];
|
||||||
|
bool has_show_display;
|
||||||
|
bool show_display;
|
||||||
} GetPublicKey;
|
} GetPublicKey;
|
||||||
|
|
||||||
typedef struct _LoadDevice {
|
typedef struct _LoadDevice {
|
||||||
@ -661,7 +663,7 @@ extern const char SimpleSignTx_coin_name_default[17];
|
|||||||
#define PassphraseAck_init_default {""}
|
#define PassphraseAck_init_default {""}
|
||||||
#define GetEntropy_init_default {0}
|
#define GetEntropy_init_default {0}
|
||||||
#define Entropy_init_default {{0, {0}}}
|
#define Entropy_init_default {{0, {0}}}
|
||||||
#define GetPublicKey_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, ""}
|
#define GetPublicKey_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0}
|
||||||
#define PublicKey_init_default {HDNodeType_init_default, false, ""}
|
#define PublicKey_init_default {HDNodeType_init_default, false, ""}
|
||||||
#define GetAddress_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "Bitcoin", false, 0, false, MultisigRedeemScriptType_init_default}
|
#define GetAddress_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "Bitcoin", false, 0, false, MultisigRedeemScriptType_init_default}
|
||||||
#define Address_init_default {""}
|
#define Address_init_default {""}
|
||||||
@ -715,7 +717,7 @@ extern const char SimpleSignTx_coin_name_default[17];
|
|||||||
#define PassphraseAck_init_zero {""}
|
#define PassphraseAck_init_zero {""}
|
||||||
#define GetEntropy_init_zero {0}
|
#define GetEntropy_init_zero {0}
|
||||||
#define Entropy_init_zero {{0, {0}}}
|
#define Entropy_init_zero {{0, {0}}}
|
||||||
#define GetPublicKey_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, ""}
|
#define GetPublicKey_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0}
|
||||||
#define PublicKey_init_zero {HDNodeType_init_zero, false, ""}
|
#define PublicKey_init_zero {HDNodeType_init_zero, false, ""}
|
||||||
#define GetAddress_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0, false, MultisigRedeemScriptType_init_zero}
|
#define GetAddress_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, false, "", false, 0, false, MultisigRedeemScriptType_init_zero}
|
||||||
#define Address_init_zero {""}
|
#define Address_init_zero {""}
|
||||||
@ -829,6 +831,7 @@ extern const char SimpleSignTx_coin_name_default[17];
|
|||||||
#define GetEntropy_size_tag 1
|
#define GetEntropy_size_tag 1
|
||||||
#define GetPublicKey_address_n_tag 1
|
#define GetPublicKey_address_n_tag 1
|
||||||
#define GetPublicKey_ecdsa_curve_name_tag 2
|
#define GetPublicKey_ecdsa_curve_name_tag 2
|
||||||
|
#define GetPublicKey_show_display_tag 3
|
||||||
#define LoadDevice_mnemonic_tag 1
|
#define LoadDevice_mnemonic_tag 1
|
||||||
#define LoadDevice_node_tag 2
|
#define LoadDevice_node_tag 2
|
||||||
#define LoadDevice_pin_tag 3
|
#define LoadDevice_pin_tag 3
|
||||||
@ -906,7 +909,7 @@ extern const pb_field_t PassphraseRequest_fields[1];
|
|||||||
extern const pb_field_t PassphraseAck_fields[2];
|
extern const pb_field_t PassphraseAck_fields[2];
|
||||||
extern const pb_field_t GetEntropy_fields[2];
|
extern const pb_field_t GetEntropy_fields[2];
|
||||||
extern const pb_field_t Entropy_fields[2];
|
extern const pb_field_t Entropy_fields[2];
|
||||||
extern const pb_field_t GetPublicKey_fields[3];
|
extern const pb_field_t GetPublicKey_fields[4];
|
||||||
extern const pb_field_t PublicKey_fields[3];
|
extern const pb_field_t PublicKey_fields[3];
|
||||||
extern const pb_field_t GetAddress_fields[5];
|
extern const pb_field_t GetAddress_fields[5];
|
||||||
extern const pb_field_t Address_fields[2];
|
extern const pb_field_t Address_fields[2];
|
||||||
@ -962,7 +965,7 @@ extern const pb_field_t DebugLinkLog_fields[4];
|
|||||||
#define PassphraseAck_size 53
|
#define PassphraseAck_size 53
|
||||||
#define GetEntropy_size 6
|
#define GetEntropy_size 6
|
||||||
#define Entropy_size 1027
|
#define Entropy_size 1027
|
||||||
#define GetPublicKey_size 82
|
#define GetPublicKey_size 84
|
||||||
#define PublicKey_size (121 + HDNodeType_size)
|
#define PublicKey_size (121 + HDNodeType_size)
|
||||||
#define GetAddress_size (75 + MultisigRedeemScriptType_size)
|
#define GetAddress_size (75 + MultisigRedeemScriptType_size)
|
||||||
#define Address_size 38
|
#define Address_size 38
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const pb_field_t Storage_fields[11] = {
|
const pb_field_t Storage_fields[12] = {
|
||||||
PB_FIELD2( 1, UINT32 , REQUIRED, STATIC , FIRST, Storage, version, version, 0),
|
PB_FIELD2( 1, UINT32 , REQUIRED, STATIC , FIRST, Storage, version, version, 0),
|
||||||
PB_FIELD2( 2, MESSAGE , OPTIONAL, STATIC , OTHER, Storage, node, version, &HDNodeType_fields),
|
PB_FIELD2( 2, MESSAGE , OPTIONAL, STATIC , OTHER, Storage, node, version, &HDNodeType_fields),
|
||||||
PB_FIELD2( 3, STRING , OPTIONAL, STATIC , OTHER, Storage, mnemonic, node, 0),
|
PB_FIELD2( 3, STRING , OPTIONAL, STATIC , OTHER, Storage, mnemonic, node, 0),
|
||||||
@ -16,6 +16,7 @@ const pb_field_t Storage_fields[11] = {
|
|||||||
PB_FIELD2( 8, STRING , OPTIONAL, STATIC , OTHER, Storage, label, language, 0),
|
PB_FIELD2( 8, STRING , OPTIONAL, STATIC , OTHER, Storage, label, language, 0),
|
||||||
PB_FIELD2( 9, BOOL , OPTIONAL, STATIC , OTHER, Storage, imported, label, 0),
|
PB_FIELD2( 9, BOOL , OPTIONAL, STATIC , OTHER, Storage, imported, label, 0),
|
||||||
PB_FIELD2( 10, BYTES , OPTIONAL, STATIC , OTHER, Storage, homescreen, imported, 0),
|
PB_FIELD2( 10, BYTES , OPTIONAL, STATIC , OTHER, Storage, homescreen, imported, 0),
|
||||||
|
PB_FIELD2( 11, UINT32 , OPTIONAL, STATIC , OTHER, Storage, u2f_counter, homescreen, 0),
|
||||||
PB_LAST_FIELD
|
PB_LAST_FIELD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,13 +37,15 @@ typedef struct _Storage {
|
|||||||
bool imported;
|
bool imported;
|
||||||
bool has_homescreen;
|
bool has_homescreen;
|
||||||
Storage_homescreen_t homescreen;
|
Storage_homescreen_t homescreen;
|
||||||
|
bool has_u2f_counter;
|
||||||
|
uint32_t u2f_counter;
|
||||||
} Storage;
|
} Storage;
|
||||||
|
|
||||||
/* Default values for struct fields */
|
/* Default values for struct fields */
|
||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define Storage_init_default {0, false, HDNodeType_init_default, false, "", false, 0, false, 0, false, "", false, "", false, "", false, 0, false, {0, {0}}}
|
#define Storage_init_default {0, false, HDNodeType_init_default, false, "", false, 0, false, 0, false, "", false, "", false, "", false, 0, false, {0, {0}}, false, 0}
|
||||||
#define Storage_init_zero {0, false, HDNodeType_init_zero, false, "", false, 0, false, 0, false, "", false, "", false, "", false, 0, false, {0, {0}}}
|
#define Storage_init_zero {0, false, HDNodeType_init_zero, false, "", false, 0, false, 0, false, "", false, "", false, "", false, 0, false, {0, {0}}, false, 0}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define Storage_version_tag 1
|
#define Storage_version_tag 1
|
||||||
@ -56,12 +58,13 @@ typedef struct _Storage {
|
|||||||
#define Storage_label_tag 8
|
#define Storage_label_tag 8
|
||||||
#define Storage_imported_tag 9
|
#define Storage_imported_tag 9
|
||||||
#define Storage_homescreen_tag 10
|
#define Storage_homescreen_tag 10
|
||||||
|
#define Storage_u2f_counter_tag 11
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
extern const pb_field_t Storage_fields[11];
|
extern const pb_field_t Storage_fields[12];
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define Storage_size (1359 + HDNodeType_size)
|
#define Storage_size (1365 + HDNodeType_size)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -53,7 +53,8 @@ typedef enum _ButtonRequestType {
|
|||||||
ButtonRequestType_ButtonRequest_ProtectCall = 7,
|
ButtonRequestType_ButtonRequest_ProtectCall = 7,
|
||||||
ButtonRequestType_ButtonRequest_SignTx = 8,
|
ButtonRequestType_ButtonRequest_SignTx = 8,
|
||||||
ButtonRequestType_ButtonRequest_FirmwareCheck = 9,
|
ButtonRequestType_ButtonRequest_FirmwareCheck = 9,
|
||||||
ButtonRequestType_ButtonRequest_Address = 10
|
ButtonRequestType_ButtonRequest_Address = 10,
|
||||||
|
ButtonRequestType_ButtonRequest_PublicKey = 11
|
||||||
} ButtonRequestType;
|
} ButtonRequestType;
|
||||||
|
|
||||||
typedef enum _PinMatrixRequestType {
|
typedef enum _PinMatrixRequestType {
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 72268e816b8e8e06f698b3729223a255c7c74167
|
Subproject commit 9983a12276689afff8e28e1bd78605b8e6d63c1c
|
Loading…
Reference in New Issue
Block a user