mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-24 23:38:09 +00:00
fsm: Do not wipe msg_resp in DebugLinkGetState
This commit is contained in:
parent
11d424cdef
commit
e33e1ec0b1
@ -1108,46 +1108,50 @@ void fsm_msgSetU2FCounter(SetU2FCounter *msg)
|
|||||||
void fsm_msgDebugLinkGetState(DebugLinkGetState *msg)
|
void fsm_msgDebugLinkGetState(DebugLinkGetState *msg)
|
||||||
{
|
{
|
||||||
(void)msg;
|
(void)msg;
|
||||||
RESP_INIT(DebugLinkState);
|
|
||||||
|
|
||||||
resp->has_layout = true;
|
// Do not use RESP_INIT because it clears msg_resp, but another message
|
||||||
resp->layout.size = OLED_BUFSIZE;
|
// might be being handled
|
||||||
memcpy(resp->layout.bytes, oledGetBuffer(), OLED_BUFSIZE);
|
DebugLinkState resp;
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
|
||||||
|
resp.has_layout = true;
|
||||||
|
resp.layout.size = OLED_BUFSIZE;
|
||||||
|
memcpy(resp.layout.bytes, oledGetBuffer(), OLED_BUFSIZE);
|
||||||
|
|
||||||
if (storage.has_pin) {
|
if (storage.has_pin) {
|
||||||
resp->has_pin = true;
|
resp.has_pin = true;
|
||||||
strlcpy(resp->pin, storage.pin, sizeof(resp->pin));
|
strlcpy(resp.pin, storage.pin, sizeof(resp.pin));
|
||||||
}
|
}
|
||||||
|
|
||||||
resp->has_matrix = true;
|
resp.has_matrix = true;
|
||||||
strlcpy(resp->matrix, pinmatrix_get(), sizeof(resp->matrix));
|
strlcpy(resp.matrix, pinmatrix_get(), sizeof(resp.matrix));
|
||||||
|
|
||||||
resp->has_reset_entropy = true;
|
resp.has_reset_entropy = true;
|
||||||
resp->reset_entropy.size = reset_get_int_entropy(resp->reset_entropy.bytes);
|
resp.reset_entropy.size = reset_get_int_entropy(resp.reset_entropy.bytes);
|
||||||
|
|
||||||
resp->has_reset_word = true;
|
resp.has_reset_word = true;
|
||||||
strlcpy(resp->reset_word, reset_get_word(), sizeof(resp->reset_word));
|
strlcpy(resp.reset_word, reset_get_word(), sizeof(resp.reset_word));
|
||||||
|
|
||||||
resp->has_recovery_fake_word = true;
|
resp.has_recovery_fake_word = true;
|
||||||
strlcpy(resp->recovery_fake_word, recovery_get_fake_word(), sizeof(resp->recovery_fake_word));
|
strlcpy(resp.recovery_fake_word, recovery_get_fake_word(), sizeof(resp.recovery_fake_word));
|
||||||
|
|
||||||
resp->has_recovery_word_pos = true;
|
resp.has_recovery_word_pos = true;
|
||||||
resp->recovery_word_pos = recovery_get_word_pos();
|
resp.recovery_word_pos = recovery_get_word_pos();
|
||||||
|
|
||||||
if (storage.has_mnemonic) {
|
if (storage.has_mnemonic) {
|
||||||
resp->has_mnemonic = true;
|
resp.has_mnemonic = true;
|
||||||
strlcpy(resp->mnemonic, storage.mnemonic, sizeof(resp->mnemonic));
|
strlcpy(resp.mnemonic, storage.mnemonic, sizeof(resp.mnemonic));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storage.has_node) {
|
if (storage.has_node) {
|
||||||
resp->has_node = true;
|
resp.has_node = true;
|
||||||
memcpy(&(resp->node), &(storage.node), sizeof(HDNode));
|
memcpy(&(resp.node), &(storage.node), sizeof(HDNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
resp->has_passphrase_protection = true;
|
resp.has_passphrase_protection = true;
|
||||||
resp->passphrase_protection = storage.has_passphrase_protection && storage.passphrase_protection;
|
resp.passphrase_protection = storage.has_passphrase_protection && storage.passphrase_protection;
|
||||||
|
|
||||||
msg_debug_write(MessageType_MessageType_DebugLinkState, resp);
|
msg_debug_write(MessageType_MessageType_DebugLinkState, &resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsm_msgDebugLinkStop(DebugLinkStop *msg)
|
void fsm_msgDebugLinkStop(DebugLinkStop *msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user