1# Bluetooth LE stack configuration options 2 3# Copyright (c) 2016-2020 Nordic Semiconductor ASA 4# Copyright (c) 2015-2016 Intel Corporation 5# SPDX-License-Identifier: Apache-2.0 6 7config BT_LONG_WQ 8 bool "Dedicated workqueue for long-running tasks." 9 default y if BT_GATT_CACHING 10 help 11 Adds an API for a workqueue dedicated to long-running tasks. 12 13if BT_LONG_WQ 14config BT_LONG_WQ_STACK_SIZE 15 int "Long workqueue stack size." 16 default 4096 if NO_OPTIMIZATIONS 17 default 1400 if BT_ECC 18 default 1300 if BT_GATT_CACHING 19 default 1024 20 help 21 The stack size used for the long workqueue. In most cases it's best to use the default 22 values, however since the actual requirement depends on the underlying crypto backend 23 this option can be used to finetune the stack size. 24 25config BT_LONG_WQ_PRIO 26 int "Long workqueue priority. Should be preemptible." 27 default 10 28 range 0 NUM_PREEMPT_PRIORITIES 29 30config BT_LONG_WQ_INIT_PRIO 31 int "Long workqueue init priority" 32 default 50 33 help 34 Init priority level to setup the long workqueue. 35 36endif # BT_LONG_WQ 37 38config BT_HCI_HOST 39 # Hidden option to make the conditions more intuitive 40 bool 41 default y 42 depends on !BT_HCI_RAW 43 select POLL 44 45config BT_HCI_TX_STACK_SIZE 46 # NOTE: This value is derived from other symbols and should only be 47 # changed if required by architecture 48 int 49 prompt "HCI Tx thread stack size" if BT_HCI_TX_STACK_SIZE_WITH_PROMPT 50 default 512 if BT_H4 51 default 512 if BT_H5 52 default 416 if BT_SPI 53 default 1280 if BT_LL_SW_SPLIT && (NO_OPTIMIZATIONS || BT_ISO_BROADCAST) 54 default 1024 if BT_LL_SW_SPLIT && BT_CENTRAL 55 default 768 if BT_LL_SW_SPLIT 56 default 512 if BT_USERCHAN 57 default 640 if BT_STM32_IPM 58 # Even if no driver is selected the following default is still 59 # needed e.g. for unit tests. This default will also server as 60 # the worst-case stack size if an out-of-tree controller is used. 61 default 1024 62 help 63 Stack size needed for executing bt_send with specified driver. 64 NOTE: This is an advanced setting and should not be changed unless 65 absolutely necessary. To change this you must first select 66 BT_HCI_TX_STACK_SIZE_WITH_PROMPT. 67 68config BT_HCI_TX_STACK_SIZE_WITH_PROMPT 69 bool "Override HCI Tx thread stack size" 70 71config BT_HCI_TX_PRIO 72 # Hidden option for Co-Operative Tx thread priority 73 int 74 default 7 75 76choice BT_RECV_CONTEXT 77 prompt "BT RX Thread Selection" 78 default BT_RECV_WORKQ_SYS if SOC_SERIES_NRF51X 79 default BT_RECV_WORKQ_BT 80 help 81 Selects in which context incoming low priority HCI packets are processed. 82 The host defines some events as high priority to avoid race conditions and deadlocks. 83 High priority events are always processed in the context of the caller of bt_recv() 84 or bt_recv_prio(). The choice will influence RAM usage and how fast incoming HCI 85 packets are processed. 86 87config BT_RECV_WORKQ_SYS 88 bool "Process low priority HCI packets in the system work queue" 89 help 90 When this option is selected, the host will process incoming low priority HCI packets 91 in the system work queue. 92 The application needs to ensure the system workqueue stack size (SYSTEM_WORKQUEUE_STACK_SIZE) 93 is large enough, refer to BT_RX_STACK_SIZE for the recommended minimum. 94 Warning: Enabling this option will cause the latency of incoming Bluetooth events to be 95 affected by other tasks using the system work queue. When this option is active, the Host 96 will process Bluetooth events in a blocking manner. This can lead to deadlocks if the 97 application waits for the system work queue while handling Bluetooth events. This feature 98 is intended for advanced users to allow aggressive memory optimization for devices with 99 very limited memory. It is strongly advised not to use this option. 100 101config BT_RECV_WORKQ_BT 102 bool "Process low priority HCI packets in the bluetooth-specific work queue" 103 help 104 When this option is selected, the host will process incoming low priority HCI packets 105 in the Bluetooth-specific work queue. 106 The application needs to ensure the bluetooth-specific work queue size is large enough, 107 refer to BT_RX_STACK_SIZE for the recommended minimum. 108endchoice 109 110config BT_RX_STACK_SIZE 111 int "Size of the receiving thread stack" 112 default 768 if BT_HCI_RAW 113 default 3092 if BT_MESH_GATT_CLIENT 114 default 2800 if BT_MESH_PB_GATT 115 default 2600 if BT_MESH 116 default 2048 if BT_AUDIO 117 default 1200 118 help 119 Size of the receiving thread stack. This is the context from 120 which all event callbacks to the application occur. The 121 default value is sufficient for basic operation, but if the 122 application needs to do advanced things in its callbacks that 123 require extra stack space, this value can be increased to 124 accommodate for that. 125 126config BT_RX_PRIO 127 # Hidden option for Co-Operative Rx thread priority 128 int 129 default 8 130 131config BT_DRIVER_RX_HIGH_PRIO 132 # Hidden option for Co-Operative HCI driver RX thread priority 133 int 134 default 6 135 136config BT_TX_PROCESSOR_THREAD 137 # This thread is used to send pending HCI Commands, ACL and ISO data to 138 # Controller. 139 bool 140 # This option is automatically selected for all platforms except nRF51 141 # due to limited RAM on nRF51 devices. 142 default y if !SOC_SERIES_NRF51X 143 144if BT_TX_PROCESSOR_THREAD 145 146config BT_TX_PROCESSOR_THREAD_PRIO 147 int 148 default SYSTEM_WORKQUEUE_PRIORITY 149 150config BT_TX_PROCESSOR_STACK_SIZE 151 int 152 default 1024 153 154endif 155 156config BT_CONN_TX_NOTIFY_WQ 157 bool "Use a separate workqueue for connection TX notify processing [EXPERIMENTAL]" 158 depends on BT_CONN_TX 159 select EXPERIMENTAL 160 help 161 Use a separate workqueue instead of system workqueue for 162 bt_conn_tx_notify processing. The option can be used to make Bluetooth 163 stack more independent from the system workqueue. 164 165if BT_CONN_TX_NOTIFY_WQ 166 167config BT_CONN_TX_NOTIFY_WQ_STACK_SIZE 168 int "Stack size of workqueue for connection TX notify processing" 169 default SYSTEM_WORKQUEUE_STACK_SIZE 170 171config BT_CONN_TX_NOTIFY_WQ_PRIO 172 int "Cooperative priority of workqueue for connection TX notify processing" 173 default 8 174 175config BT_CONN_TX_NOTIFY_WQ_INIT_PRIORITY 176 int "Init priority of workqueue for connection TX notify processing" 177 default 50 178 help 179 The connection TX notify processing workqueue is initialized during 180 system initialization (at POST_KERNEL level). The Kconfig option 181 controls the initialization priority within level. 182 183endif # BT_CONN_TX_NOTIFY_WQ 184 185menu "Bluetooth Host" 186 187if BT_HCI_HOST 188 189rsource "../mesh/Kconfig" 190rsource "../audio/Kconfig" 191 192config BT_BUF_EVT_DISCARDABLE_SIZE 193 int "Maximum supported discardable HCI Event buffer length" 194 range 43 $(UINT8_MAX) if !BT_EXT_ADV 195 range 58 $(UINT8_MAX) if BT_EXT_ADV 196 # LE Extended Advertising Report event 197 default $(UINT8_MAX) if BT_CLASSIC 198 # Le Advertising Report event 199 default 43 if !BT_EXT_ADV 200 default 58 if BT_EXT_ADV 201 help 202 Maximum support discardable HCI event size of buffers in the separate 203 discardable event buffer pool. This value does not include the 204 HCI Event header. 205 The minimum size is set based on the Advertising Report. Setting 206 the buffer size different than BT_BUF_EVT_RX_SIZE can save memory. 207 208config BT_BUF_EVT_DISCARDABLE_COUNT 209 int "Number of discardable HCI Event buffers" 210 range 1 $(UINT8_MAX) 211 default 20 if BT_MESH 212 default 3 213 help 214 Number of buffers in a separate buffer pool for events which 215 the HCI driver considers discardable. Examples of such events 216 could be e.g. Advertising Reports. The benefit of having such 217 a pool is that the if there is a heavy inflow of such events 218 it will not cause the allocation for other critical events to 219 block and may even eliminate deadlocks in some cases. 220 221config BT_HOST_CRYPTO 222 bool "Use crypto functionality implemented in the Bluetooth host" 223 default y if !BT_CTLR_CRYPTO 224 select PSA_CRYPTO 225 select PSA_WANT_KEY_TYPE_AES 226 select PSA_WANT_ALG_ECB_NO_PADDING 227 help 228 The option adds the AES encryption support using PSA Crypto API 229 library if this is not provided by the controller implementation. 230 231config BT_HOST_CRYPTO_PRNG 232 bool "Use PSA crypto API library for random number generation" 233 default y 234 depends on BT_HOST_CRYPTO 235 help 236 When selected, will use PSA Crypto API library for random number generation. 237 This will consume additional ram, but may speed up the generation of random 238 numbers. 239 240 Otherwise, random numbers will be generated through multiple HCI calls, 241 which will not consume additional resources, but may take a long time, 242 depending on the length of the random data. 243 This method is generally recommended within 16 bytes. 244 245config BT_SETTINGS 246 bool "Store Bluetooth state and configuration persistently" 247 depends on SETTINGS 248 select MPU_ALLOW_FLASH_WRITE if ARM_MPU 249 help 250 When selected, the Bluetooth stack will take care of storing 251 (and restoring) the Bluetooth state (e.g. pairing keys) and 252 configuration persistently in flash. 253 254 When this option has been enabled, it's important that the 255 application makes a call to settings_load() after having done 256 all necessary initialization (e.g. calling bt_enable). The 257 reason settings_load() is handled externally to the stack, is 258 that there may be other subsystems using the settings API, in 259 which case it's more efficient to load all settings in one go, 260 instead of each subsystem doing it independently. 261 262 Warning: The Bluetooth host expects a settings backend that loads 263 settings items in handle order. 264 265if BT_SETTINGS 266config BT_SETTINGS_CCC_LAZY_LOADING 267 bool "Load CCC values from settings when peer connects" 268 depends on BT_CONN 269 default y 270 help 271 Load Client Configuration Characteristic setting right after a bonded 272 device connects. 273 Disabling this option will increase memory usage as CCC values for all 274 bonded devices will be loaded when calling settings_load. 275 276config BT_SETTINGS_DELAYED_STORE 277 # Enables delayed non-volatile storage mechanism 278 bool 279 help 280 Triggers the storage of the CF and CCC right after a write. 281 This is done in the workqueue context, in order to not block the BT RX 282 thread for too long. 283 284config BT_SETTINGS_DELAYED_STORE_MS 285 int 286 default 1000 287 help 288 (Advanced) Governs the timeout after which the settings write will 289 take effect. 290 291config BT_SETTINGS_CCC_STORE_ON_WRITE 292 bool "Store CCC value immediately after it has been written" 293 depends on BT_CONN 294 select BT_SETTINGS_DELAYED_STORE 295 default y 296 help 297 Store Client Configuration Characteristic value right after it has 298 been updated. If the option is disabled, the CCC is only stored on 299 disconnection. 300 301config BT_SETTINGS_CF_STORE_ON_WRITE 302 bool "Store CF value immediately after it has been written" 303 depends on BT_CONN && BT_GATT_CACHING 304 select BT_SETTINGS_DELAYED_STORE 305 default y 306 help 307 Store Client Supported Features value right after it has been updated. 308 If the option is disabled, the CF is only stored on disconnection. 309 310config BT_SETTINGS_USE_PRINTK 311 bool "Use snprintk to encode Bluetooth settings key strings" 312 depends on SETTINGS && PRINTK 313 default y 314 help 315 When selected, Bluetooth settings will use snprintk to encode 316 key strings. 317 When not selected, Bluetooth settings will use a faster builtin 318 function to encode the key string. The drawback is that if 319 printk is enabled then the program memory footprint will be larger. 320 321config BT_SETTINGS_CCC_STORE_MAX 322 int "Max number of Client Characteristic Configuration (CCC)" 323 default 48 324 range 1 96 325 help 326 Defines the max number of Client Characteristic Configuration (CCC) 327 that the stack can handle 328 329endif # BT_SETTINGS 330 331config BT_FILTER_ACCEPT_LIST 332 bool "Filter accept list support" 333 help 334 This option enables the filter accept list API. This takes advantage of the 335 filtering feature of a Bluetooth LE controller. 336 The filter accept list is a global list and the same list is used 337 by both scanner and advertiser. The filter accept list cannot be modified while 338 it is in use. 339 340 An Advertiser can filter which peers can connect or request scan 341 response data. 342 A scanner can filter advertisers for which it will generate 343 advertising reports. 344 Connections can be established automatically for accepted peers. 345 346config BT_LIM_ADV_TIMEOUT 347 int "Timeout for limited advertising in 1s units" 348 default 30 349 range 1 180 350 depends on BT_BROADCASTER 351 help 352 After this timeout is reached, advertisement with BT_LE_AD_LIMITED flag 353 set shall be terminated. As per BT Core Spec 5.2, Vol 3, Part C, 354 Appendix A (NORMATIVE): TIMERS AND CONSTANTS it's required to be no more 355 than 180s. 356 357config BT_CONN_TX_USER_DATA_SIZE 358 int 359 default 32 if 64BIT 360 default 16 361 help 362 Necessary user_data size for stack usage. Mostly used for passing 363 callbacks around. See `struct closure` in conn_internal.h. 364 365config BT_CONN_FRAG_COUNT 366 int 367 default BT_MAX_CONN if BT_CONN 368 default BT_ISO_MAX_CHAN if BT_ISO 369 help 370 Internal kconfig that sets the maximum amount of simultaneous data 371 packets in flight. It should be equal to the number of connections. 372 373if BT_CONN 374 375config BT_CONN_TX_MAX 376 int "Maximum number of pending TX buffers with a callback [DEPRECATED]" 377 default BT_BUF_ACL_TX_COUNT 378 range BT_BUF_ACL_TX_COUNT $(UINT8_MAX) 379 help 380 Maximum number of pending TX buffers that have an associated 381 callback. Normally this can be left to the default value, which 382 is equal to the number of TX buffers in the controller. 383 384config BT_CONN_PARAM_ANY 385 bool "Accept any values for connection parameters" 386 help 387 Some controllers support additional connection parameter ranges 388 beyond what is described in the specification. Enabling this option 389 allows the application to set any value to all connection parameters. 390 The Host will perform no limits nor consistency checks on any of the 391 connection parameters (conn interval min and max, latency and timeout). 392 However, the Host will still use numerical comparisons between the 393 min and max connection intervals in order to verify whether the 394 desired parameters have been established in the connection. 395 396config BT_CONN_CHECK_NULL_BEFORE_CREATE 397 bool "Check if *conn is NULL when creating a connection" 398 help 399 Enable this option to ensure that bt_conn_le_create and 400 bt_conn_le_create_synced return an error if *conn is not initialized 401 to NULL. This option is recommended to use to catch programming 402 errors where the application reuses the connection pointer of an 403 active connection object without dereferencing it. Without 404 dereferencing, the connection object stays alive which can lead to an 405 unpredictable behavior. 406 407if BT_PHY_UPDATE 408 409config BT_USER_PHY_UPDATE 410 bool "User control of PHY Update Procedure" 411 help 412 Enable application access to initiate the PHY Update Procedure. 413 The application can also register a callback to be notified about PHY 414 changes on the connection. The current PHY info is available in the 415 connection info. 416 417config BT_AUTO_PHY_UPDATE 418 bool "Auto-initiate PHY Update Procedure [DEPRECATED]" 419 select DEPRECATED 420 help 421 Initiate PHY Update Procedure on connection establishment. This will attempt 422 to update the connection to use 2M PHY, however it doesn't actually guarantee 423 that this is what will be used in the end. 424 425 This option has been deprecated in favor of role specific options. The equivalent 426 behavior can be accomplished by enabling BT_AUTO_PHY_PERIPHERAL_2M and 427 BT_AUTO_PHY_CENTRAL_2M. 428 429choice BT_AUTO_PHY_PERIPHERAL 430 prompt "Auto PHY update for peripheral role" 431 depends on BT_PERIPHERAL 432 default BT_AUTO_PHY_PERIPHERAL_2M if BT_AUTO_PHY_UPDATE 433 default BT_AUTO_PHY_PERIPHERAL_NONE 434 435config BT_AUTO_PHY_PERIPHERAL_NONE 436 bool "No PHY preference" 437 438config BT_AUTO_PHY_PERIPHERAL_1M 439 bool "1M PHY" 440 441config BT_AUTO_PHY_PERIPHERAL_2M 442 bool "2M PHY" 443 444config BT_AUTO_PHY_PERIPHERAL_CODED 445 bool "Coded PHY" 446 447endchoice # BT_AUTO_PHY_PERIPHERAL 448 449choice BT_AUTO_PHY_CENTRAL 450 prompt "Auto PHY update for central role" 451 depends on BT_CENTRAL 452 default BT_AUTO_PHY_CENTRAL_2M 453 454config BT_AUTO_PHY_CENTRAL_NONE 455 bool "No PHY preference" 456 457config BT_AUTO_PHY_CENTRAL_1M 458 bool "1M PHY" 459 460config BT_AUTO_PHY_CENTRAL_2M 461 bool "2M PHY" 462 463config BT_AUTO_PHY_CENTRAL_CODED 464 bool "Coded PHY" 465 466endchoice # BT_AUTO_PHY_CENTRAL 467 468endif # BT_PHY_UPDATE 469 470config BT_USER_DATA_LEN_UPDATE 471 bool "User control of Data Length Update Procedure" 472 depends on BT_DATA_LEN_UPDATE 473 help 474 Enable application access to initiate the Data Length Update 475 Procedure. The application can also a register callback to be notified 476 about Data Length changes on the connection. The current Data Length 477 info is available in the connection info. 478 479config BT_AUTO_DATA_LEN_UPDATE 480 bool "Auto-initiate Data Length Update procedure" 481 depends on BT_DATA_LEN_UPDATE 482 default y if !BT_USER_DATA_LEN_UPDATE 483 help 484 Initiate Data Length Update Procedure on connection establishment. 485 486 Disable this if you want the Data Length Update Procedure feature 487 supported but want to rely on the remote device to initiate the 488 procedure at its discretion or want to initiate manually. 489 490config BT_REMOTE_INFO 491 bool "Application access to remote information" 492 help 493 Enable application access to the remote information available in the 494 stack. The remote information is retrieved once a connection has been 495 established and the application will be notified when this information 496 is available through the remote_info_available connection callback. 497 498config BT_SMP 499 bool "Security Manager Protocol support" 500 select BT_CRYPTO 501 select BT_RPA 502 select BT_ECC if !BT_SMP_OOB_LEGACY_PAIR_ONLY 503 help 504 This option enables support for the Security Manager Protocol 505 (SMP), making it possible to pair devices over LE. 506 507if BT_SMP 508 509config BT_SECURITY_ERR_TO_STR 510 bool "Print security error codes as strings [EXPERIMENTAL]" 511 select EXPERIMENTAL 512 help 513 This configuration enables printing of security error 514 codes represented as strings. 515 See bt_security_err_to_str() for more details. 516 517config BT_SMP_ERR_TO_STR 518 bool "Print SMP error codes as strings [EXPERIMENTAL]" 519 select EXPERIMENTAL 520 help 521 This configuration enables printing of SMP error 522 codes represented as strings. 523 See bt_smp_err_to_str() for more details. 524 525config BT_PASSKEY_KEYPRESS 526 bool "Passkey Keypress Notification support [EXPERIMENTAL]" 527 select EXPERIMENTAL 528 help 529 Enable support for receiving and sending Keypress Notifications during 530 Passkey Entry during pairing. 531 532config BT_PRIVACY 533 bool "Device privacy" 534 help 535 Enable privacy for the local device. This makes the device use Resolvable 536 Private Addresses (RPAs) by default. 537 538 Note: 539 Establishing connections as a directed advertiser, or to a directed 540 advertiser is only possible if the controller also supports privacy. 541 542config BT_PRIVACY_RANDOMIZE_IR 543 bool "Randomize identity root for fallback identities" 544 depends on BT_PRIVACY 545 select BT_SETTINGS 546 help 547 Enabling this option will cause the Host to ignore controller-provided 548 identity roots (IR). The Host will instead use bt_rand to generate 549 identity resolving keys (IRK) and store them in the settings subsystem. 550 551 Setting this config may come with a performance penalty to boot time, 552 as the hardware RNG may need time to generate entropy and will block 553 Bluetooth initialization. 554 555 This option increases privacy, as explained in the following text. 556 557 The IR determines the IRK of the identity. The IRK is used to both 558 generate and resolve (recognize) the private addresses of an identity. 559 The IRK is a shared secret, distributed to peers bonded to that 560 identity. 561 562 An attacker that has stolen or once bonded and retained the IRK can 563 forever resolve addresses from that IRK, even if that bond has been 564 deleted locally. 565 566 Deleting an identity should ideally delete the IRK as well and thereby 567 restore anonymity from previously bonded peers. But unless this config 568 is set, this does not always happen. 569 570 In particular, a factory reset function that wipes the data in the 571 settings subsystem may not affect the controller-provided IRs. If 572 those IRs are reused, this device can be tracked across factory resets. 573 574 For optimal privacy, a new IRK (i.e., identity) should be used per 575 bond. However, this naturally limits advertisements from that identity 576 to be recognizable by only that one bonded device. 577 578 A description of the exact effect of this setting follows. 579 580 If the application has not setup an identity before calling 581 settings_load()/settings_load_subtree("bt") after bt_enable(), the 582 Host will automatically try to load saved identities from the settings 583 subsystem, and if there are none, set up the default identity 584 (BT_ID_DEFAULT). 585 586 If the controller has a public address (HCI_Read_BD_ADDR), that becomes 587 the address of the default identity. The Host will by default try to 588 obtain the IR for that identity from the controller (by Zephyr HCI 589 Read_Key_Hierarchy_Roots). Setting this config randomizes the IR 590 instead. 591 592 If the controller does not have a public address, the Host will try 593 to source the default identity from the static address information 594 from controller (Zephyr HCI Read_Static_Addresses). This results in an 595 identity for each entry in Read_Static_Addresses. Setting this config 596 randomizes the IRs during this process. 597 598config BT_RPA_TIMEOUT 599 int "Resolvable Private Address timeout" 600 depends on BT_PRIVACY 601 default 900 602 range 1 $(UINT16_MAX) 603 help 604 This option defines how often resolvable private address is rotated. 605 Value is provided in seconds and defaults to 900 seconds (15 minutes). 606 607config BT_RPA_TIMEOUT_DYNAMIC 608 bool "Support setting the Resolvable Private Address timeout at runtime" 609 depends on BT_PRIVACY 610 help 611 This option allows the user to override the default value of 612 the Resolvable Private Address timeout using dedicated APIs. 613 614config BT_RPA_SHARING 615 bool "Share the Resolvable Private Address between advertising sets" 616 depends on BT_PRIVACY && BT_EXT_ADV 617 help 618 This option configures the advertising sets linked with the same 619 Bluetooth identity to use the same Resolvable Private Address in 620 a given rotation period. After the RPA timeout, the new RPA is 621 generated and shared between the advertising sets in the subsequent 622 rotation period. When this option is disabled, the generated RPAs 623 of the advertising sets differ from each other in a given rotation 624 period. 625 626config BT_SIGNING 627 bool "Data signing support" 628 select DEPRECATED 629 help 630 This option enables data signing which is used for transferring 631 authenticated data in an unencrypted connection. 632 633config BT_SMP_APP_PAIRING_ACCEPT 634 bool "Accept or reject pairing initiative" 635 help 636 When receiving pairing request or pairing response query the 637 application whether to accept to proceed with pairing or not. This is 638 for pairing over SMP and does not affect SSP, which will continue 639 pairing without querying the application. 640 The application can return an error code, which is translated into 641 a SMP return value if the pairing is not allowed. 642 643config BT_SMP_SC_PAIR_ONLY 644 bool "Disable legacy pairing" 645 default y 646 help 647 This option disables LE legacy pairing and forces LE secure connection 648 pairing. All Security Mode 1 levels can be used with legacy pairing 649 disabled, but pairing with devices that do not support secure 650 connections pairing will not be supported. 651 To force a higher security level use "Secure Connections Only Mode" 652 653config BT_SMP_SC_ONLY 654 bool "Secure Connections Only Mode" 655 select BT_SMP_SC_PAIR_ONLY 656 help 657 This option enables support for Secure Connection Only Mode. In this 658 mode device shall only use Security Mode 1 Level 4 with exception 659 for services that only require Security Mode 1 Level 1 (no security). 660 Security Mode 1 Level 4 stands for authenticated LE Secure Connections 661 pairing with encryption. Enabling this option disables legacy pairing. 662 663config BT_SMP_OOB_LEGACY_PAIR_ONLY 664 bool "Force Out Of Band Legacy pairing" 665 depends on !(BT_SMP_SC_PAIR_ONLY || BT_SMP_SC_ONLY) 666 help 667 This option disables Legacy and LE SC pairing and forces legacy OOB. 668 669config BT_SMP_DISABLE_LEGACY_JW_PASSKEY 670 bool "Forbid usage of insecure legacy pairing methods" 671 depends on !(BT_SMP_SC_PAIR_ONLY || BT_SMP_SC_ONLY || \ 672 BT_SMP_OOB_LEGACY_PAIR_ONLY) 673 help 674 This option disables Just Works and Passkey legacy pairing methods to 675 increase security. 676 677config BT_SMP_ALLOW_UNAUTH_OVERWRITE 678 bool "Allow unauthenticated pairing for paired device" 679 help 680 This option allows all unauthenticated pairing attempts made by the 681 peer where an unauthenticated bond already exists. 682 This would enable cases where an attacker could copy the peer device 683 address to connect and start an unauthenticated pairing procedure 684 to replace the existing bond. When this option is disabled in order 685 to create a new bond the old bond has to be explicitly deleted with 686 bt_unpair. 687 688config BT_ID_UNPAIR_MATCHING_BONDS 689 bool "Delete bond with same peer with other local identity when bonding" 690 help 691 When a bond is about to complete, find any other bond with the same 692 peer address (or IRK) and `bt_unpair` that bond before the event 693 `pairing_complete`. 694 695 Important: If this option is not enabled, the current implementation 696 will automatically fail the bonding. See "RL limitation" below. 697 698 Important: If this option is not enabled, as Peripheral, it may be too 699 late to abort the bonding. The pairing is failed locally, but it may 700 still be reported as successful on the Central. When this situation 701 occurs, the Zephyr Peripheral will immediately disconnect. See "SMP 702 limitation" below. 703 704 [RL limitation]: 705 The Host implementers have considered it unlikely that applications 706 would ever want to have multiple bonds with the same peer. The 707 implementers prioritize the simplicity of the implementation over this 708 capability. 709 710 The Resolve List on a Controller is not able to accommodate multiple 711 local addresses/IRKs for a single remote address. This would prevent 712 the Host from setting up a one-to-one correspondence between the Host 713 bond database and the Controller Resolve List. The implementation 714 relies on that capability when using the Resolve List. For performance 715 reasons, there is the wish to not fallback to Host Address Resolution 716 in this case. 717 718 [SMP Limitation]: 719 The Paring Failed command of the Security Manager Protocol cannot be 720 sent outside of a Pairing Process. A Pairing Process ends when the 721 last Transport Specific Key to be distributed is acknowledged at 722 link-layer. The Host does not have control over this acknowledgment, 723 and the order of distribution is fixed by the specification. 724 725config BT_ID_ALLOW_UNAUTH_OVERWRITE 726 bool "Allow unauthenticated pairing with same peer with other local identity" 727 depends on !BT_SMP_ALLOW_UNAUTH_OVERWRITE 728 help 729 This option allows unauthenticated pairing attempts made by the 730 peer where an unauthenticated bond already exists on other local 731 identity. This configuration still blocks unauthenticated pairing 732 attempts on the same local identity. To allow the pairing procedure 733 unconditionally, please see the BT_SMP_ALLOW_UNAUTH_OVERWRITE 734 configuration. 735 736config BT_SMP_USB_HCI_CTLR_WORKAROUND 737 bool "Workaround for USB HCI controller out-of-order events" 738 depends on BT_TESTING 739 help 740 This option enables support for USB HCI controllers that sometimes 741 send out-of-order HCI events and ACL Data due to using different USB 742 endpoints. 743 Enabling this option will make the central role not require the 744 encryption-change event to be received before accepting key-distribution 745 data. 746 It opens up for a potential vulnerability as the central cannot detect 747 if the keys are distributed over an encrypted link. 748 749config BT_FIXED_PASSKEY 750 bool "Use a fixed passkey for pairing [DEPRECATED]" 751 select DEPRECATED 752 help 753 This option is deprecated, use BT_APP_PASSKEY instead. 754 With this option enabled, the application will be able to call the 755 bt_passkey_set() API to set a fixed passkey. If set, the 756 pairing_confirm() callback will be called for all incoming pairings. 757 758config BT_APP_PASSKEY 759 bool "Allow the application to provide passkeys for pairing" 760 depends on !BT_FIXED_PASSKEY 761 help 762 With this option enabled, the application will be able to provide passkeys for pairing 763 using the app_passkey() callback. If the application does not provide a passkey, a 764 random passkey will be generated by the Host. 765 766 WARNING: It is the responsibility of the application to use random and unique keys. 767 768config BT_USE_DEBUG_KEYS 769 bool "Security Manager Debug Mode" 770 help 771 This option places Security Manager in a Debug Mode. In this mode 772 predefined Diffie-Hellman private/public key pair is used as described 773 in Core Specification Vol. 3, Part H, 2.3.5.6.1. 774 775 WARNING: This option enables anyone to decrypt on-air traffic. 776 Use of this feature in production is strongly discouraged. 777 778config BT_BONDABLE 779 bool "Bondable Mode" 780 default y 781 help 782 This option is the default value of the bonding flag for any ACL connection. 783 If the option is true, the default bonding flag is true. Or, the default 784 bonding flag is false. 785 After a connection is established, the bonding flag of the connection 786 can also be changed by calling `bt_conn_set_bondable()` if the configuration 787 `the bonding flag per-connection` (BT_BONDABLE_PER_CONNECTION) is 788 enabled. Please see the BT_BONDABLE_PER_CONNECTION configuration. 789 790config BT_BONDING_REQUIRED 791 bool "Always require bonding" 792 depends on BT_BONDABLE 793 help 794 When this option is enabled remote devices are required to always 795 set the bondable flag in their pairing request. Any other kind of 796 requests will be rejected. 797 798config BT_BONDABLE_PER_CONNECTION 799 bool "Set/clear the bonding flag per-connection" 800 help 801 Enable support for the bt_conn_set_bondable API function that is 802 used to set/clear the bonding flag on a per-connection basis. 803 804config BT_STORE_DEBUG_KEYS 805 bool "Store Debug Mode bonds" 806 help 807 This option enables support for storing bonds where either of devices 808 is using the predefined Diffie-Hellman private/public key pair as 809 described in the Core Specification Vol 3, Part H, 2.3.5.6.1. 810 811 WARNING: This option potentially enables anyone to decrypt on-air 812 traffic. 813 Use of this feature in production is strongly discouraged. 814 815config BT_SMP_ENFORCE_MITM 816 bool "Enforce MITM protection" 817 default y 818 help 819 With this option enabled, the Security Manager will set MITM option in 820 the Authentication Requirements Flags whenever local IO Capabilities 821 allow the generated key to be authenticated. 822 823config BT_OOB_DATA_FIXED 824 bool "Use a fixed random number for LESC OOB pairing" 825 depends on BT_TESTING 826 help 827 With this option enabled, the application will be able to perform LESC 828 pairing with OOB data that consists of fixed random number and confirm 829 value. 830 831 WARNING: This option stores a hardcoded Out-of-Band value in the image. 832 Use of this feature in production is strongly discouraged. 833 834config BT_KEYS_OVERWRITE_OLDEST 835 bool "Overwrite the oldest key if key storage is full" 836 help 837 If a pairing attempt occurs and the key storage is full then the 838 oldest key from the set of not currently in use keys will be selected 839 and overwritten by the pairing device. 840 841config BT_KEYS_SAVE_AGING_COUNTER_ON_PAIRING 842 bool "Store aging counter every time a successful paring occurs" 843 depends on BT_SETTINGS && BT_KEYS_OVERWRITE_OLDEST 844 help 845 With this option enabled, aging counter will be stored in settings every 846 time a successful pairing occurs. This increases flash wear out but offers 847 a more correct finding of the oldest unused pairing info. 848 849config BT_SMP_MIN_ENC_KEY_SIZE 850 int 851 prompt "Minimum encryption key size accepted in octets" if !BT_SMP_SC_ONLY 852 range 7 16 853 default 16 854 help 855 This option sets the minimum encryption key size accepted during pairing. 856 857endif # BT_SMP 858 859rsource "Kconfig.l2cap" 860rsource "Kconfig.gatt" 861rsource "../services/Kconfig" 862 863config BT_MAX_PAIRED 864 int "Maximum number of paired devices" 865 default 0 if !BT_SMP 866 default 1 867 range 0 250 868 help 869 Maximum number of paired Bluetooth devices. The minimum (and 870 default) number is 1. 871 872config BT_CREATE_CONN_TIMEOUT 873 int "Timeout for pending LE Create Connection command in seconds" 874 default 3 875 range 1 655 876 877config BT_CONN_PARAM_UPDATE_TIMEOUT 878 int "Peripheral connection parameter update timeout in milliseconds" 879 default 5000 880 range 0 $(UINT16_MAX) 881 help 882 The value is a timeout used by peripheral device to wait until it 883 starts the first connection parameters update procedure after a 884 connection has been established. 885 The connection parameters requested will be the parameters set by the 886 application, or the peripheral preferred connection parameters if 887 configured. 888 The default value is set to 5 seconds, to comply with the Bluetooth 889 Core specification: Core 4.2 Vol 3, Part C, 9.3.12.2: 890 "The Peripheral device should not perform a Connection Parameter 891 Update procedure within 5 seconds after establishing a connection." 892 893config BT_CONN_PARAM_RETRY_COUNT 894 int "Peripheral connection parameter update retry attempts" 895 default 3 896 range 0 $(UINT8_MAX) 897 help 898 This value corresponds to number of times to retry connection 899 parameter update to attain the preferred value set in GATT 900 characteristics in the Peripheral. 901 902config BT_CONN_PARAM_RETRY_TIMEOUT 903 int "Peripheral connection parameter update retry timeout in milliseconds" 904 default 5000 905 range 0 $(UINT16_MAX) 906 help 907 The value is a timeout used by peripheral device to wait until retry 908 to attempt requesting again the preferred connection parameters. 909 910endif # BT_CONN 911 912if BT_OBSERVER 913config BT_BACKGROUND_SCAN_INTERVAL 914 int "Scan interval used for background scanning in 0.625 ms units" 915 default 2048 916 range 4 16384 917config BT_BACKGROUND_SCAN_WINDOW 918 int "Scan window used for background scanning in 0.625 ms units" 919 default 18 920 range 4 16384 921 922config BT_EXT_SCAN_BUF_SIZE 923 int "Maximum advertisement report size" 924 depends on BT_EXT_ADV 925 range 1 1650 926 default 229 927 help 928 Maximum size of an advertisement report in octets. If the advertisement 929 provided by the controller is larger than this buffer size, 930 the remaining data will be discarded. 931 932endif # BT_OBSERVER 933 934config BT_SCAN_WITH_IDENTITY 935 bool "Perform active scanning using local identity address" 936 depends on !BT_PRIVACY && (BT_CENTRAL || BT_OBSERVER) 937 help 938 Enable this if you want to perform active scanning using the local 939 identity address as the scanner address. By default the stack will 940 always use a non-resolvable private address (NRPA) in order to avoid 941 disclosing local identity information. By not scanning with the 942 identity address the scanner will receive directed advertise reports 943 for the local identity. If this use case is required, then enable 944 this option. 945 946config BT_SCAN_AND_INITIATE_IN_PARALLEL 947 bool "Allow concurrent scanning and initiating" 948 depends on (BT_CENTRAL && BT_OBSERVER) 949 select BT_EXT_ADV if BT_BROADCASTER 950 select BT_SCAN_WITH_IDENTITY if !BT_PRIVACY 951 help 952 Allow concurrent scanning and initiating. 953 This will allow the application to initiate a connection 954 to a peer device without stopping the scanner. 955 If privacy is disabled, the scanner will use its identity 956 address. 957 This feature is only available when extended advertising 958 HCI commands are used to prevent degraded performance 959 when the advertiser is used. 960 Scanning with a timeout is not supported when this 961 feature is enabled. 962 963config BT_DEVICE_NAME_DYNAMIC 964 bool "Allow to set Bluetooth device name on runtime" 965 help 966 Enabling this option allows for runtime configuration of Bluetooth 967 device name. 968 969config BT_DEVICE_NAME_MAX 970 int "Maximum size in bytes for device name" 971 depends on BT_DEVICE_NAME_DYNAMIC 972 default 28 973 range 2 248 974 help 975 Bluetooth device name storage size. Storage can be up to 248 bytes 976 long (excluding NULL termination). 977 978config BT_DEVICE_NAME 979 string "Bluetooth device name" 980 default "Zephyr" 981 help 982 Bluetooth device name. Name can be up to 248 bytes long (excluding 983 NULL termination). Can be empty string. 984 985config BT_DEVICE_APPEARANCE_DYNAMIC 986 bool "Runtime Bluetooth Appearance changing" 987 help 988 Enables use of bt_set_appearance. 989 If CONFIG_BT_SETTINGS is set, the appearance is persistently stored. 990 991config BT_DEVICE_APPEARANCE 992 int "Bluetooth device appearance" 993 range 0 $(UINT16_MAX) 994 default 0 995 help 996 Bluetooth device appearance. For the list of possible values please 997 consult the following link: 998 https://www.bluetooth.com/specifications/assigned-numbers 999 1000config BT_ID_MAX 1001 int "Maximum number of local identities" 1002 range 1 1 if BT_SCAN_AND_INITIATE_IN_PARALLEL 1003 range 1 250 1004 default 1 1005 help 1006 Maximum number of supported local identity addresses. For most 1007 products this is safe to leave as the default value (1). 1008 1009config BT_DF 1010 bool "Direction Finding support [EXPERIMENTAL]" 1011 depends on !HAS_BT_CTLR || BT_CTLR_DF_SUPPORT 1012 select EXPERIMENTAL 1013 help 1014 Enable support for Bluetooth 5.1 Direction Finding. 1015 It will allow to: get information about antennae, configure 1016 Constant Tone Extension, transmit CTE and sample incoming CTE. 1017 1018if BT_DF 1019 1020config BT_DF_CONNECTIONLESS_CTE_RX 1021 bool "Support for receive of CTE in connectionless mode" 1022 depends on !HAS_BT_CTLR || BT_CTLR_DF_CTE_RX_SUPPORT 1023 help 1024 Enable support for reception and sampling of Constant Tone Extension 1025 in connectionless mode. 1026 1027config BT_DF_CONNECTIONLESS_CTE_TX 1028 bool "Support for transmission of CTE in connectionless mode" 1029 depends on !HAS_BT_CTLR || BT_CTLR_DF_CTE_TX_SUPPORT 1030 help 1031 Enable support for transmission of Constant Tone Extension in 1032 connectionless mode. 1033 1034config BT_DF_CONNECTION_CTE_RX 1035 bool "Support for receive of CTE in connection mode" 1036 depends on !HAS_BT_CTLR || BT_CTLR_DF_CTE_RX_SUPPORT 1037 help 1038 Enable support for reception and sampling of Constant Tone Extension 1039 in connection mode. 1040 1041config BT_DF_CONNECTION_CTE_TX 1042 bool "Support for transmission of CTE in connection mode" 1043 depends on !HAS_BT_CTLR || BT_CTLR_DF_CTE_TX_SUPPORT 1044 help 1045 Enable support for transmission of Constant Tone Extension in 1046 connection mode. 1047 1048config BT_DF_CONNECTION_CTE_REQ 1049 bool "Support for CTE request procedure in connection mode" 1050 depends on BT_DF_CONNECTION_CTE_RX 1051 help 1052 Enable support for request of Constant Tone Extension in connection 1053 mode. 1054 1055config BT_DF_CONNECTION_CTE_RSP 1056 bool "Support for CTE request procedure in connection mode" 1057 depends on BT_DF_CONNECTION_CTE_TX 1058 help 1059 Enable support for request of Constant Tone Extension in connection 1060 mode. 1061 1062config BT_DF_CTE_RX_AOA 1063 bool "Antenna switching during CTE reception (AoA) feature" 1064 depends on BT_DF_CONNECTIONLESS_CTE_RX || BT_DF_CONNECTION_CTE_RX 1065 default y 1066 help 1067 Enable support for antenna switching during CTE reception. 1068 Also known as Angle of Arrival mode. 1069 1070config BT_DF_CTE_TX_AOD 1071 bool "Antenna switching during CTE transmission (AoD) feature" 1072 depends on BT_DF_CONNECTIONLESS_CTE_TX || BT_DF_CONNECTION_CTE_TX 1073 default y 1074 help 1075 Enable support for antenna switching during CTE transmission. 1076 Also known as Angle of Departure mode. 1077 1078config BT_DF_VS_CL_IQ_REPORT_16_BITS_IQ_SAMPLES 1079 bool "Use 16 bits signed integer IQ samples in connectionless IQ reports" 1080 depends on BT_DF_CONNECTIONLESS_CTE_RX && BT_HCI_VS 1081 help 1082 Direction Finding connectionless IQ reports provide a set of IQ samples collected during 1083 sampling of CTE. Bluetooth 5.3 Core Specification defines IQ samples to be 8 bits signed 1084 integer, see Vol 4, Part E section 7.7.65.21. This option enables a vendor specific Host 1085 extension to handle connectionless IQ reports with samples that are in 16 bit signed 1086 integer format. 1087 1088config BT_DF_VS_CONN_IQ_REPORT_16_BITS_IQ_SAMPLES 1089 bool "Use 16 bits signed integer IQ samples in connection IQ reports" 1090 depends on BT_DF_CONNECTION_CTE_RX && BT_HCI_VS 1091 help 1092 Direction Finding connection IQ reports provide a set of IQ samples collected during 1093 sampling of CTE. Bluetooth 5.3 Core Specification defines IQ samples to be 8 bits signed 1094 integer, see Vol 4, Part E sections 7.7.65.22. This option enables a vendor specific Host 1095 extension to handle connection IQ report with samples that are in 16 bit signed integer 1096 format. 1097 1098endif # BT_DF 1099 1100config BT_ECC 1101 bool 1102 select PSA_CRYPTO 1103 select PSA_WANT_ALG_ECDH 1104 select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE 1105 select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT 1106 select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT 1107 select PSA_WANT_ECC_SECP_R1_256 1108 imply MBEDTLS_PSA_P256M_DRIVER_ENABLED if MBEDTLS_PSA_CRYPTO_C 1109 imply BT_LONG_WQ 1110 help 1111 If this option is set, internal APIs will be available to perform ECDH operations through 1112 the long work queue (or system work queue). The operations are used e.g. by LE Secure 1113 Connections. 1114 1115endif # BT_HCI_HOST 1116 1117config BT_HOST_CCM 1118 bool "Host side AES-CCM module" 1119 help 1120 Enables the software based AES-CCM engine in the host. Will use the 1121 controller's AES encryption functions if available, or BT_HOST_CRYPTO 1122 otherwise. 1123 1124config BT_PER_ADV_SYNC_BUF_SIZE 1125 int "Maximum periodic advertising report size" 1126 depends on BT_PER_ADV_SYNC 1127 range 0 1650 1128 default 0 1129 help 1130 Maximum size of a fragmented periodic advertising report. If the periodic 1131 advertising report provided by the controller is fragmented and larger 1132 than this buffer size, then the data will be discarded. 1133 Unfragmented reports are forwarded as they are received. 1134 1135config BT_DEBUG_ISO_DATA 1136 bool "ISO channel data debug" 1137 depends on BT_ISO_LOG_LEVEL_DBG 1138 help 1139 Use this option to enable ISO channels data debug logs for the 1140 Bluetooth Audio functionality. This will enable debug logs for all 1141 ISO data received and sent. 1142 1143config BT_SMP_SELFTEST 1144 bool "Bluetooth SMP self tests executed on init" 1145 depends on BT_SMP_LOG_LEVEL_DBG 1146 help 1147 This option enables SMP self-tests executed on startup 1148 to verify security and crypto functions. 1149 1150config BT_SMP_FORCE_BREDR 1151 bool "Force Bluetooth SMP over BR/EDR" 1152 depends on BT_SMP_LOG_LEVEL_DBG 1153 help 1154 This option enables SMP over BR/EDR even if controller is not 1155 supporting BR/EDR Secure Connections. This option is solely for 1156 testing and should never be enabled on production devices. 1157 1158config BT_LOG_SNIFFER_INFO 1159 bool "Bluetooth log information for sniffer" 1160 help 1161 This option enables the Bluetooth stack to log information such as 1162 DH private key and LTK keys, which can be used by sniffers to decrypt 1163 the connection without the use of Debug keys. 1164 1165 WARNING: This option prints out private security keys such as 1166 the Long Term Key. 1167 Use of this feature in production is strongly discouraged 1168 1169config BT_TESTING 1170 bool "Bluetooth Testing" 1171 help 1172 This option enables custom Bluetooth testing interface. 1173 Shall only be used for testing purposes. 1174 1175config BT_CONN_DISABLE_SECURITY 1176 bool "Disable security" 1177 depends on BT_TESTING 1178 help 1179 This option disables security checks for incoming requests enabling 1180 to test accessing GATT attributes and L2CAP channels that would 1181 otherwise require encryption/authentication in order to be accessed. 1182 1183 WARNING: This option enables anyone to snoop on-air traffic. 1184 Use of this feature in production is strongly discouraged. 1185 1186config BT_SMP_LEGACY_PAIR_ONLY 1187 bool "Force legacy pairing" 1188 depends on BT_TESTING 1189 depends on !(BT_SMP_SC_PAIR_ONLY || BT_SMP_SC_ONLY) 1190 help 1191 This option enforces legacy pairing. This is required for testing 1192 legacy pairing between two Zephyr Bluetooth devices, as without this 1193 option the devices will default to using Secure Connections pairing. 1194 1195rsource "./classic/Kconfig" 1196 1197config BT_HCI_VS_EVT_USER 1198 bool "User Vendor-Specific event handling" 1199 help 1200 Enable registering a callback for delegating to the user the handling of 1201 VS events that are not known to the stack 1202 1203endmenu 1204