Skip to content

Commit

Permalink
Merge pull request #52 from IOTA-Ledger/fix/lock-check
Browse files Browse the repository at this point in the history
Fix issue where locked device status not recognized in new SDK versions
  • Loading branch information
Wollac committed May 15, 2019
2 parents e9fd0fe + f8fb6fe commit 7edc25c
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit 7edc25c

Please sign in to comment.