Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where locked device status not recognized in new SDK versions #52

Merged
merged 1 commit into from
May 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ bolos_ux_params_t G_ux_params;
ux_state_t ux;
#endif // TARGET_NANOX

/// Returns true, if the device is not locked
static bool device_is_unlocked(void)
{
// this is the precise usage suggested by the SDK
return os_global_pin_is_validated() == BOLOS_UX_OK;
}

static void IOTA_main()
{
volatile unsigned int flags = 0;
Expand All @@ -30,7 +37,7 @@ static void IOTA_main()
const unsigned int rx = io_exchange(CHANNEL_APDU | flags, 0);

// the device must not be locked
if (!os_global_pin_is_validated()) {
if (!device_is_unlocked()) {
THROW(SW_DEVICE_IS_LOCKED);
}

Expand Down