Skip to content

Commit

Permalink
don't exit if atcab_idle failed (#22)
Browse files Browse the repository at this point in the history
* don't exit if atcab_idle failed

It may mean that device watchdog has switched it already.

* more specific changelog entry
  • Loading branch information
webconn authored Dec 27, 2022
1 parent d66b4a7 commit 48eeb89
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 17 deletions.
6 changes: 2 additions & 4 deletions atecc-asymm.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ int do_atecc_write_private(int argc, char **argv)
// it adds delay between ATECC init sequence in main() and this operation.
status = atcab_idle();
if (status != ATCA_SUCCESS) {
eprintf("Command atcab_idle is failed with status 0x%x\n", status);
return 2;
eprintf("Command atcab_idle is failed with status 0x%x, but let's continue\n", status);
}

ATECC_RETRY(status, atcab_priv_write(key_id, privatekey_payload, writekey_id, writekey));
Expand Down Expand Up @@ -359,8 +358,7 @@ int do_atecc_verify(int argc, char **argv)
// it adds delay between ATECC init sequence in main() and this operation.
status = atcab_idle();
if (status != ATCA_SUCCESS) {
eprintf("Command atcab_idle is failed with status 0x%x\n", status);
return 2;
eprintf("Command atcab_idle is failed with status 0x%x, but let's continue\n", status);
}

if (!pubkeyfilename) {
Expand Down
3 changes: 1 addition & 2 deletions atecc-auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ int do_atecc_auth_check_gendig(int argc, char **argv)
// it adds delay between ATECC init sequence in main() and this operation.
status = atcab_idle();
if (status != ATCA_SUCCESS) {
eprintf("Command atcab_idle is failed with status 0x%x\n", status);
return 2;
eprintf("Command atcab_idle is failed with status 0x%x, but let's continue\n", status);
}

do {
Expand Down
4 changes: 1 addition & 3 deletions atecc-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,7 @@ int do_atecc_write_config(int argc, char **argv)
// it adds delay between ATECC init sequence in main() and this operation.
status = atcab_idle();
if (status != ATCA_SUCCESS) {
eprintf("Command atcab_idle is failed with status 0x%x\n", status);
ret = 2;
goto _wcexit;
eprintf("Command atcab_idle is failed with status 0x%x, but let's continue\n", status);
}

bool is_locked;
Expand Down
6 changes: 2 additions & 4 deletions atecc-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ int do_atecc_write_data(int argc, char **argv)
// it adds delay between ATECC init sequence in main() and this operation.
status = atcab_idle();
if (status != ATCA_SUCCESS) {
eprintf("Command atcab_idle is failed with status 0x%x\n", status);
return 2;
eprintf("Command atcab_idle is failed with status 0x%x, but let's continue\n", status);
}

/* try to write data to chip */
Expand Down Expand Up @@ -155,8 +154,7 @@ int do_atecc_read_data(int argc, char **argv)
// it adds delay between ATECC init sequence in main() and this operation.
status = atcab_idle();
if (status != ATCA_SUCCESS) {
eprintf("Command atcab_idle is failed with status 0x%x\n", status);
return 2;
eprintf("Command atcab_idle is failed with status 0x%x, but let's continue\n", status);
}

/* read data from ATECC */
Expand Down
3 changes: 1 addition & 2 deletions atecc-ecdh.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ int do_atecc_ecdh(int argc, char **argv)
// it adds delay between ATECC init sequence in main() and this operation.
status = atcab_idle();
if (status != ATCA_SUCCESS) {
eprintf("Command atcab_idle is failed with status 0x%x\n", status);
return 2;
eprintf("Command atcab_idle is failed with status 0x%x, but let's continue\n", status);
}

ATECC_RETRY(status, atcab_ecdh(slot_id, pubkey, pms));
Expand Down
3 changes: 1 addition & 2 deletions atecc-hmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ int do_atecc_hmac_write_key(int argc, char **argv)
// it adds delay between ATECC init sequence in main() and this operation.
status = atcab_idle();
if (status != ATCA_SUCCESS) {
eprintf("Command atcab_idle is failed with status 0x%x\n", status);
return 2;
eprintf("Command atcab_idle is failed with status 0x%x, but let's continue\n", status);
}

const char *cmd;
Expand Down
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
atecc-util (0.4.10) stable; urgency=medium

* don't exit if atcab_idle failed (it may mean that
device watchdog has switched it to idle mode already)

-- Nikita Maslov <nikita.maslov@wirenboard.ru> Thu, 22 Dec 2022 13:54:08 +0600

atecc-util (0.4.9) stable; urgency=medium

* always send ATECC to idle mode before access
Expand Down

0 comments on commit 48eeb89

Please sign in to comment.