disabled encryption for openbeacon
This commit is contained in:
parent
fce44b3b91
commit
d9ccf797ea
|
@ -6,18 +6,20 @@
|
|||
#include "filesystem/ff.h"
|
||||
#include "basic/uuid.h"
|
||||
|
||||
//const uint32_t key[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
|
||||
#include "SECRETS"
|
||||
const uint8_t useencryption = 1;
|
||||
|
||||
const uint8_t mac[5] = {1,2,3,2,1};
|
||||
|
||||
volatile uint32_t oid = 0;
|
||||
volatile uint32_t seq = 0;
|
||||
volatile uint8_t strength = 0;
|
||||
#if ENCRYPT_OPENBEACON
|
||||
static void openbeaconSave(uint32_t s);
|
||||
#endif
|
||||
|
||||
static struct NRF_CFG oldconfig;
|
||||
|
||||
#if ENCRYPT_OPENBEACON
|
||||
static void openbeaconShutdown(void)
|
||||
{
|
||||
openbeaconSave(seq);
|
||||
|
@ -61,14 +63,16 @@ static void openbeaconRead()
|
|||
|
||||
f_close(&file);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void openbeaconSetup(void)
|
||||
{
|
||||
oid = GetUUID32();
|
||||
strength = 0;
|
||||
#if ENCRYPT_OPENBEACON
|
||||
openbeaconRead();
|
||||
openbeaconSaveBlock();
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint8_t openbeaconSendPacket(uint32_t id, uint32_t seq,
|
||||
|
@ -87,7 +91,11 @@ static uint8_t openbeaconSendPacket(uint32_t id, uint32_t seq,
|
|||
buf[12]=0xff; // salt (0xffff always?)
|
||||
buf[13]=0xff;
|
||||
|
||||
return nrf_snd_pkt_crc_encr(16,buf,useencryption?openbeaconkey:NULL);
|
||||
#if ENCRYPT_OPENBEACON
|
||||
return nrf_snd_pkt_crc_encr(16,buf,openbeaconkey);
|
||||
#else
|
||||
return nrf_snd_pkt_crc_encr(16,buf,NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t openbeaconSend(void)
|
||||
|
@ -103,8 +111,10 @@ uint8_t openbeaconSend(void)
|
|||
status = openbeaconSendPacket(oid, seq, 0xFF, strength++);
|
||||
if( strength == 4 )
|
||||
strength = 0;
|
||||
#if ENCRYPT_OPENBEACON
|
||||
if( (seq++ & OPENBEACON_SAVE) == OPENBEACON_SAVE )
|
||||
openbeaconSaveBlock();
|
||||
#endif
|
||||
nrf_config_set(&oldconfig);
|
||||
return status;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue