sm.c (e91ddb40755e32b7f518eeedb40e9a37edf017f9) | sm.c (11d10bda60903bb0c6edf9c9d86c54333cd5dde5) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 1414 unchanged lines hidden (view full) --- 1423 int i; 1424 for (i=0; i < le_device_db_max_count(); i++){ 1425 sm_key_t irk; 1426 bd_addr_t address; 1427 int address_type = BD_ADDR_TYPE_UNKNOWN; 1428 le_device_db_info(i, &address_type, address, irk); 1429 // skip unused entries 1430 if (address_type == BD_ADDR_TYPE_UNKNOWN) continue; | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 1414 unchanged lines hidden (view full) --- 1423 int i; 1424 for (i=0; i < le_device_db_max_count(); i++){ 1425 sm_key_t irk; 1426 bd_addr_t address; 1427 int address_type = BD_ADDR_TYPE_UNKNOWN; 1428 le_device_db_info(i, &address_type, address, irk); 1429 // skip unused entries 1430 if (address_type == BD_ADDR_TYPE_UNKNOWN) continue; |
1431 // compare IRK | 1431 // compare Identity Address 1432 if (memcmp(address, setup->sm_peer_address, 6) != 0) continue; 1433 // compare Identity Resolving Key |
1432 if (memcmp(irk, setup->sm_peer_irk, 16) != 0) continue; 1433 1434 log_info("sm: device found for IRK, updating"); 1435 le_db_index = i; 1436 break; 1437 } 1438 } else { 1439 // assert IRK is set to zero --- 3745 unchanged lines hidden --- | 1434 if (memcmp(irk, setup->sm_peer_irk, 16) != 0) continue; 1435 1436 log_info("sm: device found for IRK, updating"); 1437 le_db_index = i; 1438 break; 1439 } 1440 } else { 1441 // assert IRK is set to zero --- 3745 unchanged lines hidden --- |