Skip to content

Commit

Permalink
[blind] add warnings before going to blindsign flow
Browse files Browse the repository at this point in the history
  • Loading branch information
spalmer25 committed Sep 26, 2024
1 parent 1774bc4 commit 855b6bd
Show file tree
Hide file tree
Showing 61 changed files with 31 additions and 5 deletions.
21 changes: 18 additions & 3 deletions app/src/apdu_sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ static void handle_data_apdu_blind(void);
static void pass_from_clear_to_summary(void);
#ifdef HAVE_BAGL
static void init_too_many_screens_stream(void);
static void init_blind_warning_stream(void);
#endif
#ifdef HAVE_NBGL
static void continue_blindsign_cb(void);
Expand Down Expand Up @@ -336,7 +337,7 @@ refill_blo_done(void)
if (global.blindsign_reason == REASON_TOO_MANY_SCREENS) {
init_too_many_screens_stream();
} else {
init_summary_stream();
init_blind_warning_stream();
}
TZ_SUCCEED();
}
Expand Down Expand Up @@ -650,7 +651,7 @@ init_summary_stream(void)

#ifdef HAVE_BAGL
static void
too_many_screens_stream_cb(tz_ui_cb_type_t cb_type)
pass_to_summary_stream_cb(tz_ui_cb_type_t cb_type)
{
TZ_PREAMBLE(("cb_type=%u", cb_type));

Expand All @@ -668,7 +669,7 @@ too_many_screens_stream_cb(tz_ui_cb_type_t cb_type)
static void
init_too_many_screens_stream(void)
{
tz_ui_stream_init(too_many_screens_stream_cb);
tz_ui_stream_init(pass_to_summary_stream_cb);

#ifdef TARGET_NANOS
tz_ui_stream_push_warning_not_trusted("Operation too long",
Expand All @@ -685,6 +686,20 @@ init_too_many_screens_stream(void)
tz_ui_stream();
}

static void
init_blind_warning_stream(void)
{
tz_ui_stream_init(pass_to_summary_stream_cb);

tz_ui_stream_push_warning_not_trusted(NULL, NULL);
tz_ui_stream_push_risky_accept_reject(TZ_UI_STREAM_CB_VALIDATE,
TZ_UI_STREAM_CB_REJECT);

tz_ui_stream_close();

tz_ui_stream();
}

static void
bs_push_next(void)
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 13 additions & 2 deletions tests/integration/nano/test_blindsign.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,26 @@ def test_blind_sign_basic_operation(app):

def navigate() -> None:
app.navigate_until_text(Screen_text.blindsign(app.backend), path / "clear")
app.navigate_until_text(Screen_text.Accept_risk, path / "blind_warning")
app.navigate_until_text(Screen_text.Sign_accept, path / "summary")

_blind_sign(app, basic_operation, navigate)

def test_blind_reject_basic_operation(app):
path = basic_test_path / "reject"
def test_blind_reject_basic_operation_at_blind_warning(app):
path = basic_test_path / "reject_at_blind_warning"

def navigate() -> None:
app.navigate_until_text(Screen_text.blindsign(app.backend), path / "clear")
app.navigate_until_text(Screen_text.Sign_reject, path / "blind_warning")

_blind_reject(app, basic_operation, StatusCode.REJECT, navigate)

def test_blind_reject_basic_operation_at_summary(app):
path = basic_test_path / "reject_at_summary"

def navigate() -> None:
app.navigate_until_text(Screen_text.blindsign(app.backend), path / "clear")
app.navigate_until_text(Screen_text.Accept_risk, path / "blind_warning")
app.navigate_until_text(Screen_text.Sign_reject, path / "summary")

_blind_reject(app, basic_operation, StatusCode.REJECT, navigate)
Expand Down

0 comments on commit 855b6bd

Please sign in to comment.