1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-03 03:50:58 +00:00

legacy: return root_fingerprint in PublicKey

This commit is contained in:
Pavol Rusnak 2020-12-29 17:59:10 +01:00
parent 5e58835d18
commit 4d45a68fd0

View File

@ -34,8 +34,15 @@ void fsm_msgGetPublicKey(const GetPublicKey *msg) {
if (msg->has_ecdsa_curve_name) { if (msg->has_ecdsa_curve_name) {
curve = msg->ecdsa_curve_name; curve = msg->ecdsa_curve_name;
} }
// derive m/0' to obtain root_fingerprint
uint32_t root_fingerprint;
uint32_t path[1] = {0x80000000 | 0};
HDNode *node = fsm_getDerivedNode(curve, path, 1, &root_fingerprint);
if (!node) return;
uint32_t fingerprint; uint32_t fingerprint;
HDNode *node = fsm_getDerivedNode(curve, msg->address_n, msg->address_n_count, node = fsm_getDerivedNode(curve, msg->address_n, msg->address_n_count,
&fingerprint); &fingerprint);
if (!node) return; if (!node) return;
hdnode_fill_public_key(node); hdnode_fill_public_key(node);
@ -96,6 +103,9 @@ void fsm_msgGetPublicKey(const GetPublicKey *msg) {
} }
} }
resp->has_root_fingerprint = true;
resp->root_fingerprint = root_fingerprint;
msg_write(MessageType_MessageType_PublicKey, resp); msg_write(MessageType_MessageType_PublicKey, resp);
layoutHome(); layoutHome();
} }