mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-10-02 05:17:23 +00:00
nimble/ll: Add api for resolving peer RPA to any IRK on list
This is needed to properly report periodic sync transfers received since address in LL_SYNC_TRANSFER_IND is always RPA.
This commit is contained in:
@@ -98,7 +98,10 @@ int ble_ll_resolve_set_priv_mode(const uint8_t *cmdbuf, uint8_t len);
|
|||||||
uint32_t ble_ll_resolv_get_rpa_tmo(void);
|
uint32_t ble_ll_resolv_get_rpa_tmo(void);
|
||||||
|
|
||||||
/* Resolve a resolvable private address */
|
/* Resolve a resolvable private address */
|
||||||
int ble_ll_resolv_rpa(uint8_t *rpa, uint8_t *irk);
|
int ble_ll_resolv_rpa(const uint8_t *rpa, const uint8_t *irk);
|
||||||
|
|
||||||
|
/* Try to resolve peer RPA and return index on RL if matched */
|
||||||
|
int ble_ll_resolv_peer_rpa_any(const uint8_t *rpa);
|
||||||
|
|
||||||
/* Initialize resolv*/
|
/* Initialize resolv*/
|
||||||
void ble_ll_resolv_init(void);
|
void ble_ll_resolv_init(void);
|
||||||
|
|||||||
@@ -641,15 +641,15 @@ ble_ll_resolv_gen_rpa(uint8_t *addr, uint8_t addr_type, uint8_t *rpa, int local)
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ble_ll_resolv_rpa(uint8_t *rpa, uint8_t *irk)
|
ble_ll_resolv_rpa(const uint8_t *rpa, const uint8_t *irk)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
uint32_t *irk32;
|
const uint32_t *irk32;
|
||||||
uint32_t *key32;
|
uint32_t *key32;
|
||||||
uint32_t *pt32;
|
uint32_t *pt32;
|
||||||
struct ble_encryption_block ecb;
|
struct ble_encryption_block ecb;
|
||||||
|
|
||||||
irk32 = (uint32_t *)irk;
|
irk32 = (const uint32_t *)irk;
|
||||||
key32 = (uint32_t *)&ecb.key[0];
|
key32 = (uint32_t *)&ecb.key[0];
|
||||||
|
|
||||||
key32[0] = irk32[0];
|
key32[0] = irk32[0];
|
||||||
@@ -678,6 +678,20 @@ ble_ll_resolv_rpa(uint8_t *rpa, uint8_t *irk)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ble_ll_resolv_peer_rpa_any(const uint8_t *rpa)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < g_ble_ll_resolv_data.rl_cnt_hw; i++) {
|
||||||
|
if (ble_ll_resolv_rpa(rpa, g_ble_ll_resolv_list[i].rl_peer_irk)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether or not address resolution is enabled.
|
* Returns whether or not address resolution is enabled.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user