Skip to content

Commit d1e15b9

Browse files
DvdGiessendpgeorge
authored andcommitted
extmod/nimble: Enable key distribution to support bonding.
This sets the BLE key distribution parameters at runtime. This isn't needed in most ports since we already set the default values in `extmod/nimble/syscfg/syscfg.h`; however in the ESP32 port that headerfile is not used, and the default values in the ESP-IDF don't enable key distribution nor can we change those defaults via `sdkconfig`. Thus we're setting these values explicitly at runtime. Signed-off-by: Daniël van de Giessen <[email protected]>
1 parent 3460b48 commit d1e15b9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

extmod/nimble/modbluetooth_nimble.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,8 @@ int mp_bluetooth_init(void) {
617617
ble_hs_cfg.store_status_cb = ble_store_util_status_rr;
618618

619619
#if MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
620+
ble_hs_cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID | BLE_SM_PAIR_KEY_DIST_SIGN;
621+
ble_hs_cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID | BLE_SM_PAIR_KEY_DIST_SIGN;
620622
ble_hs_cfg.store_read_cb = ble_secret_store_read;
621623
ble_hs_cfg.store_write_cb = ble_secret_store_write;
622624
ble_hs_cfg.store_delete_cb = ble_secret_store_delete;

0 commit comments

Comments
 (0)