Skip to content

Commit

Permalink
Change fetching default IRK from constant to a client-supplied function
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieDriver committed Jan 4, 2022
1 parent 82f07e5 commit c197ca2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Expand Up @@ -27,11 +27,8 @@
static uint8_t ble_hs_pvcy_started;
static uint8_t ble_hs_pvcy_irk[16];

/** Use this as a default IRK if none gets set. */
const uint8_t ble_hs_pvcy_default_irk[16] = {
0xef, 0x8d, 0xe2, 0x16, 0x4f, 0xec, 0x43, 0x0d,
0xbf, 0x5b, 0xdd, 0x34, 0xc0, 0x53, 0x1e, 0xb8,
};
/** Use this function to fetch a default IRK from the client code */
extern void ble_hs_pvcy_get_default_irk(uint8_t* irk, size_t irk_len);

static int
ble_hs_pvcy_set_addr_timeout(uint16_t timeout)
Expand Down Expand Up @@ -213,7 +210,7 @@ ble_hs_pvcy_set_our_irk(const uint8_t *irk)
if (irk != NULL) {
memcpy(new_irk, irk, 16);
} else {
memcpy(new_irk, ble_hs_pvcy_default_irk, 16);
ble_hs_pvcy_get_default_irk(new_irk, sizeof(new_irk));
}

/* Clear the resolving list if this is a new IRK. */
Expand Down
Expand Up @@ -26,8 +26,6 @@
extern "C" {
#endif

extern const uint8_t ble_hs_pvcy_default_irk[16];

int ble_hs_pvcy_set_our_irk(const uint8_t *irk);
int ble_hs_pvcy_our_irk(const uint8_t **out_irk);
int ble_hs_pvcy_remove_entry(uint8_t addr_type, const uint8_t *addr);
Expand Down

0 comments on commit c197ca2

Please sign in to comment.