Skip to content

Commit 199703b

Browse files
committed
Addressing comments
1 parent 4562d7c commit 199703b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

examples/ECCX08HMAC/ECCX08HMAC.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
#include <ArduinoECCX08.h>
1414

15+
#define TEMPKEY_SLOT 0xFFFF
16+
1517
byte nonceKey[] = {
1618
0x10, 0x10, 0x10, 0x10
1719
};
@@ -47,7 +49,7 @@ void setup() {
4749
}
4850

4951
// Starting HMAC operation on tempkey slot
50-
if (!ECCX08.beginHMAC(0xFFFF)) {
52+
if (!ECCX08.beginHMAC(TEMPKEY_SLOT)) {
5153
Serial.println("Failed to start HMAC operation.");
5254
while (1);
5355
}

src/ECCX08.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,14 @@ int ECCX08Class::lock()
444444
int ECCX08Class::beginHMAC(uint16_t keySlot)
445445
{
446446
// HMAC implementation is only for ATECC608
447-
long ver = version() & 0x0F00000;
448-
if (ver != 0x0600000) {
447+
uint8_t status;
448+
long ecc608ver = 0x0600000;
449+
long eccCurrVer = version() & 0x0F00000;
450+
451+
if (eccCurVer != ecc608ver) {
449452
return 0;
450453
}
451454

452-
uint8_t status;
453-
454455
if (!wakeup()) {
455456
return 0;
456457
}

0 commit comments

Comments
 (0)