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