Microchip® Advanced Software Framework

le_device_db.h File Reference
#include "btstack_util.h"
#include "btstack_config.h"

Functions

int le_device_db_add (int addr_type, bd_addr_t addr, sm_key_t irk)
 add device to db More...
 
int le_device_db_count (void)
 get number of devices in db for enumeration More...
 
void le_device_db_dump (void)
 
void le_device_db_encryption_get (int index, uint16_t *ediv, uint8_t rand[8], sm_key_t ltk, int *key_size, int *authenticated, int *authorized)
 get remote encryption info More...
 
void le_device_db_encryption_set (int index, uint16_t ediv, uint8_t rand[8], sm_key_t ltk, int key_size, int authenticated, int authorized)
 set remote encryption info More...
 
void le_device_db_info (int index, int *addr_type, bd_addr_t addr, sm_key_t irk)
 get device information: addr type and address needed to identify device More...
 
void le_device_db_init (void)
 Note: LE Device DB for pure LE Peripherals is not required if only LE Legacy Pairing without signed writes is used. More...
 
void le_device_db_remove (int index)
 free device More...
 
void le_device_db_set_local_bd_addr (bd_addr_t bd_addr)
 sets local bd addr. More...
 

int le_device_db_add ( int  addr_type,
bd_addr_t  addr,
sm_key_t  irk 
)

add device to db

Parameters
addr_type,addressof the device
irkof the device
Returns
index if successful, -1 otherwise

References le_device_memory_db::addr_type, bd_addr_to_str(), INVALID_ENTRY_ADDR_TYPE, log_info, and log_info_key().

Referenced by sm_key_distribution_handle_all_received().

int le_device_db_count ( void  )

get number of devices in db for enumeration

Returns
number of device in db

References counter, and INVALID_ENTRY_ADDR_TYPE.

Referenced by le_device_db_dump(), sm_key_distribution_handle_all_received(), and sm_run().

void le_device_db_dump ( void  )
void le_device_db_encryption_get ( int  index,
uint16_t *  ediv,
uint8_t  rand[8],
sm_key_t  ltk,
int *  key_size,
int *  authenticated,
int *  authorized 
)
void le_device_db_encryption_set ( int  index,
uint16_t  ediv,
uint8_t  rand[8],
sm_key_t  ltk,
int  key_size,
int  authenticated,
int  authorized 
)
void le_device_db_info ( int  index,
int *  addr_type,
bd_addr_t  addr,
sm_key_t  irk 
)

get device information: addr type and address needed to identify device

Parameters
index
addr_type,addressof the device as output
irkof the device

References le_device_memory_db::addr_type.

Referenced by sm_key_distribution_handle_all_received(), sm_notify_client_index(), and sm_run().

void le_device_db_init ( void  )

Note: LE Device DB for pure LE Peripherals is not required if only LE Legacy Pairing without signed writes is used.

Per bonded device:

  • it stores the Identity Resolving Key (IRK) and its address to resolve private addresses
  • it stores the LTK + EDIV, RAND. EDIV + RAND allows a LE Peripheral to reconstruct the LTK
  • it stores the Connection Signature Resolving Key (CSRK) and the last used counter. The CSRK is used to generate the signatur on the remote device and is needed to verify the signature itself The Counter is necessary to prevent reply attacks init

References le_device_db_remove().

Referenced by le_counter_setup(), le_prov_app_setup(), and tss_app_setup().

void le_device_db_remove ( int  index)

free device

Parameters
index

References le_device_memory_db::addr_type, and INVALID_ENTRY_ADDR_TYPE.

Referenced by le_device_db_init(), and sm_event_packet_handler().

void le_device_db_set_local_bd_addr ( bd_addr_t  bd_addr)

sets local bd addr.

allows for db per Bluetooth controller

Parameters
bd_addr

Referenced by sm_event_packet_handler().