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