Skip to content

Commit

Permalink
fix bug where revisiting final page when calculating txn hash would c…
Browse files Browse the repository at this point in the history
…ause hang
  • Loading branch information
chris124567 committed Nov 14, 2023
1 parent 030e1b8 commit 62bb057
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/calcTxnHash_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ static bool nav_callback(uint8_t page, nbgl_pageContent_t *content) {
UNUSED(page);
ctx->elementIndex = page;
if (ctx->elementIndex >= ctx->txn.elementIndex) {
const bool wasFinished = ctx->finished;
ctx->finished = true;

content->type = INFO_LONG_PRESS;
Expand All @@ -119,7 +120,10 @@ static bool nav_callback(uint8_t page, nbgl_pageContent_t *content) {
content->infoLongPress.longPressText = ctx->fullStr[0];
} else {
memmove(G_io_apdu_buffer, ctx->txn.sigHash, 32);
io_exchange_with_code(SW_OK, 32);
// prevent this from being sent twice and causing device to hang
if (!wasFinished) {
io_exchange_with_code(SW_OK, 32);
}
bin2hex(ctx->fullStr[0], ctx->txn.sigHash, sizeof(ctx->txn.sigHash));

content->infoLongPress.text = ctx->fullStr[0];
Expand Down

0 comments on commit 62bb057

Please sign in to comment.