Skip to content

Commit

Permalink
bluetooth: nrf52: Use the own LTK key for LESC pairing
Browse files Browse the repository at this point in the history
Fix the issue that reconnection fails when LESC bonding information
is stored. For LESC pairing, it should use own LTK instead of peer one.
  • Loading branch information
SPRESENSE committed Oct 18, 2024
1 parent 34ccc4e commit 6abb890
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion sdk/modules/bluetooth/hal/nrf52/ble_comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3386,7 +3386,18 @@ static int nrf52_ble_pairing(uint16_t handle)
* skip pairing and only encrypt with stored key.
*/

ret = BLE_GapEncrypt(handle, &BondInfoInFlash[ret].peerEncKey);
if (BondInfoInFlash[ret].ownEncKey.master_id.ediv != 0)
{
/* LE Legacy Pairing */

ret = BLE_GapEncrypt(handle, &BondInfoInFlash[ret].peerEncKey);
}
else
{
/* LE Secure Connections Pairing */

ret = BLE_GapEncrypt(handle, &BondInfoInFlash[ret].ownEncKey);
}
}
else
{
Expand Down

0 comments on commit 6abb890

Please sign in to comment.