mirror of
https://github.com/bitlair/bitlair_doorduino.git
synced 2025-05-13 12:20:07 +02:00
fixed: don't authenticate a button when the secret is not stored in the eeprom
This commit is contained in:
parent
69f438207d
commit
d3cfe7e904
1 changed files with 6 additions and 5 deletions
|
@ -286,8 +286,12 @@ void ListButtons()
|
||||||
#define RANDOMDELAY_MIN 50
|
#define RANDOMDELAY_MIN 50
|
||||||
#define RANDOMDELAY_MAX 200
|
#define RANDOMDELAY_MAX 200
|
||||||
|
|
||||||
bool AuthenticateButton(uint8_t* addr, uint8_t* secret)
|
bool AuthenticateButton(uint8_t* addr)
|
||||||
{
|
{
|
||||||
|
uint8_t secret[SECRETSIZE];
|
||||||
|
if (!GetButtonSecret(addr, secret))
|
||||||
|
return false;
|
||||||
|
|
||||||
uint8_t mac_from_ibutton[SHA1SIZE];
|
uint8_t mac_from_ibutton[SHA1SIZE];
|
||||||
uint8_t data[32];
|
uint8_t data[32];
|
||||||
uint8_t nonce[3];
|
uint8_t nonce[3];
|
||||||
|
@ -560,10 +564,7 @@ void loop()
|
||||||
Serialprintf("%02x", addr[i]);
|
Serialprintf("%02x", addr[i]);
|
||||||
Serial.print('\n');
|
Serial.print('\n');
|
||||||
|
|
||||||
uint8_t secret[SECRETSIZE];
|
if (AuthenticateButton(addr))
|
||||||
GetButtonSecret(addr, secret);
|
|
||||||
|
|
||||||
if (AuthenticateButton(addr, secret))
|
|
||||||
{
|
{
|
||||||
SetLEDState(LEDState_Authorized);
|
SetLEDState(LEDState_Authorized);
|
||||||
Serial.print("iButton authenticated\n");
|
Serial.print("iButton authenticated\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue