From 9b3a98691c178067e87f888d986e1ec87dda66e6 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Wed, 13 Dec 2023 10:59:24 -0800 Subject: [PATCH] refactor(bt): Split security and conn exp. Kconfig * Split connection and security experimental changes into dedicated Kconfig flags for easier testing of only connection related fixes. Co-authored-by: Cem Aksoylar --- app/Kconfig | 33 ++++++++++++++++++++++++--------- docs/docs/config/bluetooth.md | 12 +++++++----- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/app/Kconfig b/app/Kconfig index a9b1b39e..70d5cc04 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -142,29 +142,44 @@ menuconfig ZMK_BLE if ZMK_BLE -config ZMK_BLE_EXPERIMENTAL_FEATURES - bool "Experimental: Enable experimental/advanced BLE settings/features" - imply ZMK_BLE_PASSKEY_ENTRY +config ZMK_BLE_EXPERIMENTAL_CONN + bool "Experimental BLE connection changes" imply BT_GATT_AUTO_SEC_REQ + help + Enables a combination of settings that are planned to be default in future versions of ZMK + to improve connection stability. This includes changes to timing on BLE pairing initation, + restores use of the updated/new LLCP implementation, and disables 2M PHY support. + +config ZMK_BLE_EXPERIMENTAL_SEC + bool "Experimental BLE security changes" imply BT_SMP_ALLOW_UNAUTH_OVERWRITE help - Enables a combination of settings that are planned to be default in future versions of ZMK. - This includes changes to timing on BLE pairing initation, BT Secure Connection passkey entry, - restores use of the updated/new LLCP implementation, disables 2M PHY support, and allows - overwrite of keys from previously paired hosts. + Enables a combination of settings that are planned to be officially supported in the future. + This includes enabling BT Secure Connection passkey entry, and allows overwrite of keys from + previously paired hosts. + +config ZMK_BLE_EXPERIMENTAL_FEATURES + bool "Experimental BLE connection and security settings/features" + select ZMK_BLE_EXPERIMENTAL_CONN + select ZMK_BLE_EXPERIMENTAL_SEC + help + Enables experimental connection changes and security features. config ZMK_BLE_PASSKEY_ENTRY bool "Require passkey entry on the keyboard to complete pairing" default n select RING_BUFFER +config BT_SMP_ALLOW_UNAUTH_OVERWRITE + imply ZMK_BLE_PASSKEY_ENTRY + choice BT_LL_SW_LLCP_IMPL - default BT_LL_SW_LLCP_LEGACY if !ZMK_BLE_EXPERIMENTAL_FEATURES + default BT_LL_SW_LLCP_LEGACY if !ZMK_BLE_EXPERIMENTAL_CONN endchoice config BT_CTLR_PHY_2M - default n if ZMK_BLE_EXPERIMENTAL_FEATURES + default n if ZMK_BLE_EXPERIMENTAL_CONN # BT_TINYCRYPT_ECC is required for BT_SMP_SC_PAIR_ONLY when using HCI config BT_TINYCRYPT_ECC diff --git a/docs/docs/config/bluetooth.md b/docs/docs/config/bluetooth.md index 61477cb5..9149b36b 100644 --- a/docs/docs/config/bluetooth.md +++ b/docs/docs/config/bluetooth.md @@ -9,8 +9,10 @@ See [Configuration Overview](index.md) for instructions on how to change these s ## Kconfig -| Option | Type | Description | Default | -| -------------------------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| `CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES` | bool | Enables a combination of settings that are planned to be default in future versions of ZMK. This includes changes to timing on BLE pairing initation, BT Secure Connection passkey entry, restores use of the updated/new LLCP implementation, disables 2M PHY support, and allows overwrite of keys from previously paired hosts. | n | -| `CONFIG_ZMK_BLE_PASSKEY_ENTRY` | bool | Enable passkey entry during pairing for enhanced security. (Note: After enabling this, you will need to re-pair all previously paired hosts) | n | -| `CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION` | bool | Low level setting for GATT subscriptions. Set to `n` to work around an annoying Windows bug with battery notifications. | y | +| Option | Type | Description | Default | +| -------------------------------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | +| `CONFIG_ZMK_BLE_EXPERIMENTAL_CONN` | bool | Enables a combination of settings that are planned to be default in future versions of ZMK to improve connection stability. This includes changes to timing on BLE pairing initation, restores use of the updated/new LLCP implementation, and disables 2M PHY support. | n | +| `CONFIG_ZMK_BLE_EXPERIMENTAL_SEC` | bool | Enables a combination of settings that are planned to be officially supported in the future. This includes enabling BT Secure Connection passkey entry, and allows overwrite of keys from previously paired hosts. | n | +| `CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES` | bool | Aggregate config that enables both `CONFIG_ZMK_BLE_EXPERIMENTAL_CONN` and `CONFIG_ZMK_BLE_EXPERIMENTAL_SEC`. | n | +| `CONFIG_ZMK_BLE_PASSKEY_ENTRY` | bool | Enable passkey entry during pairing for enhanced security. (Note: After enabling this, you will need to re-pair all previously paired hosts.) | n | +| `CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION` | bool | Low level setting for GATT subscriptions. Set to `n` to work around an annoying Windows bug with battery notifications. | y |