mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-11 00:40:00 +00:00
sm: improve le_device_db lookup and storing of IRK
This commit is contained in:
parent
9650eb2f69
commit
c7e2c1a542
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
### Fixed
|
||||
- SM: Fix LE Secure Connection pairing in Central role
|
||||
- le_device_db_tlv: fix seq nr management
|
||||
- SM: improve le_device_db lookup and storing of IRK
|
||||
|
||||
## Changes April 2018
|
||||
|
||||
|
18
src/ble/sm.c
18
src/ble/sm.c
@ -1204,14 +1204,20 @@ static void sm_key_distribution_handle_all_received(sm_connection_t * sm_conn){
|
||||
for (i=0; i < le_device_db_max_count(); i++){
|
||||
sm_key_t irk;
|
||||
bd_addr_t address;
|
||||
int address_type;
|
||||
int address_type = BD_ADDR_TYPE_UNKNOWN;
|
||||
le_device_db_info(i, &address_type, address, irk);
|
||||
if (memcmp(irk, setup->sm_peer_irk, 16) == 0){
|
||||
log_info("sm: device found for IRK, updating");
|
||||
le_db_index = i;
|
||||
break;
|
||||
}
|
||||
// check if valid entry retrieved
|
||||
if (address_type == BD_ADDR_TYPE_UNKNOWN) continue;
|
||||
// compare IRK
|
||||
if (memcmp(irk, setup->sm_peer_irk, 16) != 0) continue;
|
||||
|
||||
log_info("sm: device found for IRK, updating");
|
||||
le_db_index = i;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// assert IRK is set to zero
|
||||
memset(setup->sm_peer_irk, 0, 16);
|
||||
}
|
||||
|
||||
// if not found, lookup via public address if possible
|
||||
|
Loading…
x
Reference in New Issue
Block a user