Skip to content

Commit 479af4a

Browse files
committed
Fix failure to reconnect to device when bonded.
iOS devices specifically expect to receive the ID key of the bonded device even when RPA is not used. This sets the default value of the key distribution config to provide the ID key as well as the encryption key.
1 parent 6d8eb8a commit 479af4a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/NimBLEDevice.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,8 +891,8 @@ void NimBLEDevice::init(const std::string &deviceName) {
891891
ble_hs_cfg.sm_bonding = 0;
892892
ble_hs_cfg.sm_mitm = 0;
893893
ble_hs_cfg.sm_sc = 1;
894-
ble_hs_cfg.sm_our_key_dist = 1;
895-
ble_hs_cfg.sm_their_key_dist = 3;
894+
ble_hs_cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID;
895+
ble_hs_cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID;
896896

897897
ble_hs_cfg.store_status_cb = ble_store_util_status_rr; /*TODO: Implement handler for this*/
898898

0 commit comments

Comments
 (0)