From 4d45a68fd0968ce39a8f7955dc61f529c586245b Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 29 Dec 2020 17:59:10 +0100 Subject: [PATCH] legacy: return root_fingerprint in PublicKey --- legacy/firmware/fsm_msg_coin.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/legacy/firmware/fsm_msg_coin.h b/legacy/firmware/fsm_msg_coin.h index 1cddd232fb..f45e362472 100644 --- a/legacy/firmware/fsm_msg_coin.h +++ b/legacy/firmware/fsm_msg_coin.h @@ -34,9 +34,16 @@ void fsm_msgGetPublicKey(const GetPublicKey *msg) { if (msg->has_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; - HDNode *node = fsm_getDerivedNode(curve, msg->address_n, msg->address_n_count, - &fingerprint); + node = fsm_getDerivedNode(curve, msg->address_n, msg->address_n_count, + &fingerprint); if (!node) return; 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); layoutHome(); }