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