Bluetooth: Host: Remove HCI ECC emulation
Remove the HCI command & event emulation layer for ECDH commands and events. This means that we always do the necessary operations in the host. The existing BT_ECC Kconfig option stays, but now gets automatically enabled when necessary (e.g. based on the BT_SMP option), which is why this commit removes so many explicit assignments in prj.conf files. Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
This commit is contained in:
parent
020cb79d27
commit
09e86f3b69
67 changed files with 198 additions and 677 deletions
|
|
@ -10,8 +10,6 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191
|
CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_BT_EXT_ADV=y
|
CONFIG_BT_EXT_ADV=y
|
||||||
CONFIG_BT_PER_ADV_SYNC=y
|
CONFIG_BT_PER_ADV_SYNC=y
|
||||||
CONFIG_BT_BAP_BASS_MAX_SUBGROUPS=2
|
CONFIG_BT_BAP_BASS_MAX_SUBGROUPS=2
|
||||||
|
|
|
||||||
|
|
@ -25,5 +25,3 @@ CONFIG_BT_AUDIO_CODEC_CAP_MAX_METADATA_SIZE=64
|
||||||
CONFIG_BT_AUDIO_CODEC_CAP_MAX_DATA_SIZE=64
|
CONFIG_BT_AUDIO_CODEC_CAP_MAX_DATA_SIZE=64
|
||||||
|
|
||||||
CONFIG_BT_DEVICE_NAME="Broadcast Audio Sink"
|
CONFIG_BT_DEVICE_NAME="Broadcast Audio Sink"
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_LIBLC3=y
|
CONFIG_LIBLC3=y
|
||||||
CONFIG_FPU=y
|
CONFIG_FPU=y
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_LIBLC3=y
|
CONFIG_LIBLC3=y
|
||||||
CONFIG_FPU=y
|
CONFIG_FPU=y
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
# For LE-audio at 10ms intervals we need the tick counter to occur more frequently
|
# For LE-audio at 10ms intervals we need the tick counter to occur more frequently
|
||||||
# than every 10 ms as each PDU for some reason takes 2 ticks to process.
|
# than every 10 ms as each PDU for some reason takes 2 ticks to process.
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ CONFIG_MAIN_STACK_SIZE=512
|
||||||
CONFIG_BT=y
|
CONFIG_BT=y
|
||||||
CONFIG_BT_HCI_RAW=y
|
CONFIG_BT_HCI_RAW=y
|
||||||
CONFIG_BT_MAX_CONN=16
|
CONFIG_BT_MAX_CONN=16
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=n
|
|
||||||
|
|
||||||
# Workaround: Unable to allocate command buffer when using K_NO_WAIT since
|
# Workaround: Unable to allocate command buffer when using K_NO_WAIT since
|
||||||
# Host number of completed commands does not follow normal flow control.
|
# Host number of completed commands does not follow normal flow control.
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=255
|
CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=255
|
||||||
CONFIG_BT_CTLR_ASSERT_HANDLER=y
|
CONFIG_BT_CTLR_ASSERT_HANDLER=y
|
||||||
CONFIG_BT_MAX_CONN=16
|
CONFIG_BT_MAX_CONN=16
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=n
|
|
||||||
CONFIG_BT_CTLR_DTM_HCI=y
|
CONFIG_BT_CTLR_DTM_HCI=y
|
||||||
|
|
||||||
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
|
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=255
|
CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=255
|
||||||
CONFIG_BT_MAX_CONN=16
|
CONFIG_BT_MAX_CONN=16
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=n
|
|
||||||
CONFIG_BT_CTLR_DTM_HCI=y
|
CONFIG_BT_CTLR_DTM_HCI=y
|
||||||
|
|
||||||
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
|
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
# Copyright (c) 2022 Telink Semiconductor
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=n
|
|
||||||
|
|
@ -7,6 +7,5 @@ CONFIG_LOG=y
|
||||||
CONFIG_BT_PERIPHERAL=y
|
CONFIG_BT_PERIPHERAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_MAX_PAIRED=2
|
CONFIG_BT_MAX_PAIRED=2
|
||||||
CONFIG_BT_DEVICE_NAME="SC only peripheral"
|
CONFIG_BT_DEVICE_NAME="SC only peripheral"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_LIBLC3=y
|
CONFIG_LIBLC3=y
|
||||||
CONFIG_FPU=y
|
CONFIG_FPU=y
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_LIBLC3=y
|
CONFIG_LIBLC3=y
|
||||||
CONFIG_FPU=y
|
CONFIG_FPU=y
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_LIBLC3=y
|
CONFIG_LIBLC3=y
|
||||||
CONFIG_FPU=y
|
CONFIG_FPU=y
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_LIBLC3=y
|
CONFIG_LIBLC3=y
|
||||||
CONFIG_FPU=y
|
CONFIG_FPU=y
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_LIBLC3=y
|
CONFIG_LIBLC3=y
|
||||||
CONFIG_FPU=y
|
CONFIG_FPU=y
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_LIBLC3=y
|
CONFIG_LIBLC3=y
|
||||||
CONFIG_FPU=y
|
CONFIG_FPU=y
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_LIBLC3=y
|
CONFIG_LIBLC3=y
|
||||||
CONFIG_FPU=y
|
CONFIG_FPU=y
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
CONFIG_LOG_MODE_IMMEDIATE=y
|
CONFIG_LOG_MODE_IMMEDIATE=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_LIBLC3=y
|
CONFIG_LIBLC3=y
|
||||||
CONFIG_FPU=y
|
CONFIG_FPU=y
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ CONFIG_BT_CTLR_PRIVACY=n
|
||||||
CONFIG_BT_PERIPHERAL=y
|
CONFIG_BT_PERIPHERAL=y
|
||||||
|
|
||||||
CONFIG_BT=y
|
CONFIG_BT=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_L2CAP_TX_BUF_COUNT=8
|
CONFIG_BT_L2CAP_TX_BUF_COUNT=8
|
||||||
|
|
||||||
CONFIG_BT_MESH=y
|
CONFIG_BT_MESH=y
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
|
||||||
|
|
||||||
CONFIG_BT_PERIPHERAL=y
|
CONFIG_BT_PERIPHERAL=y
|
||||||
CONFIG_BT=y
|
CONFIG_BT=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_RX_STACK_SIZE=4096
|
CONFIG_BT_RX_STACK_SIZE=4096
|
||||||
CONFIG_BT_L2CAP_TX_BUF_COUNT=8
|
CONFIG_BT_L2CAP_TX_BUF_COUNT=8
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,6 @@
|
||||||
#include <zephyr/bluetooth/hci_vs.h>
|
#include <zephyr/bluetooth/hci_vs.h>
|
||||||
#include <zephyr/bluetooth/buf.h>
|
#include <zephyr/bluetooth/buf.h>
|
||||||
|
|
||||||
#include "../host/hci_ecc.h"
|
|
||||||
|
|
||||||
#include "util/util.h"
|
#include "util/util.h"
|
||||||
#include "util/memq.h"
|
#include "util/memq.h"
|
||||||
#include "util/mem.h"
|
#include "util/mem.h"
|
||||||
|
|
@ -1049,10 +1047,6 @@ static void read_supported_commands(struct net_buf *buf, struct net_buf **evt)
|
||||||
rp->commands[41] |= BIT(1);
|
rp->commands[41] |= BIT(1);
|
||||||
#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */
|
#endif /* CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_HCI_RAW) && defined(CONFIG_BT_SEND_ECC_EMULATION)
|
|
||||||
bt_hci_ecc_supported_commands(rp->commands);
|
|
||||||
#endif /* CONFIG_BT_HCI_RAW && CONFIG_BT_SEND_ECC_EMULATION */
|
|
||||||
|
|
||||||
/* LE Read TX Power. */
|
/* LE Read TX Power. */
|
||||||
rp->commands[38] |= BIT(7);
|
rp->commands[38] |= BIT(7);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ add_subdirectory_ifdef(CONFIG_BT_SHELL shell)
|
||||||
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_BT_HCI_RAW hci_raw.c hci_common.c)
|
zephyr_library_sources_ifdef(CONFIG_BT_HCI_RAW hci_raw.c hci_common.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_BT_MONITOR monitor.c)
|
zephyr_library_sources_ifdef(CONFIG_BT_MONITOR monitor.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_BT_SEND_ECC_EMULATION hci_ecc.c)
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_BT_SETTINGS settings.c)
|
zephyr_library_sources_ifdef(CONFIG_BT_SETTINGS settings.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_BT_HOST_CCM aes_ccm.c)
|
zephyr_library_sources_ifdef(CONFIG_BT_HOST_CCM aes_ccm.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_BT_LONG_WQ long_wq.c)
|
zephyr_library_sources_ifdef(CONFIG_BT_LONG_WQ long_wq.c)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ config BT_LONG_WQ_STACK_SIZE
|
||||||
# Hidden: Long workqueue stack size. Should be derived from system
|
# Hidden: Long workqueue stack size. Should be derived from system
|
||||||
# requirements.
|
# requirements.
|
||||||
int
|
int
|
||||||
default 1400 if BT_SEND_ECC_EMULATION
|
default 1400 if BT_ECC
|
||||||
default 1300 if BT_GATT_CACHING
|
default 1300 if BT_GATT_CACHING
|
||||||
default 1024
|
default 1024
|
||||||
|
|
||||||
|
|
@ -407,7 +407,7 @@ config BT_SMP
|
||||||
bool "Security Manager Protocol support"
|
bool "Security Manager Protocol support"
|
||||||
select BT_CRYPTO
|
select BT_CRYPTO
|
||||||
select BT_RPA
|
select BT_RPA
|
||||||
select BT_ECC
|
select BT_ECC if !BT_SMP_OOB_LEGACY_PAIR_ONLY
|
||||||
help
|
help
|
||||||
This option enables support for the Security Manager Protocol
|
This option enables support for the Security Manager Protocol
|
||||||
(SMP), making it possible to pair devices over LE.
|
(SMP), making it possible to pair devices over LE.
|
||||||
|
|
@ -991,16 +991,9 @@ config BT_DF_VS_CONN_IQ_REPORT_16_BITS_IQ_SAMPLES
|
||||||
format.
|
format.
|
||||||
|
|
||||||
endif # BT_DF
|
endif # BT_DF
|
||||||
endif # BT_HCI_HOST
|
|
||||||
|
|
||||||
config BT_ECC
|
config BT_ECC
|
||||||
bool "ECDH key generation support"
|
bool "ECDH key generation support"
|
||||||
default y if BT_SMP && !BT_SMP_OOB_LEGACY_PAIR_ONLY
|
|
||||||
help
|
|
||||||
This option adds support for ECDH HCI commands.
|
|
||||||
|
|
||||||
config BT_SEND_ECC_EMULATION
|
|
||||||
bool "Emulate ECDH in the Host using PSA Crypto API library"
|
|
||||||
select MBEDTLS if !BUILD_WITH_TFM
|
select MBEDTLS if !BUILD_WITH_TFM
|
||||||
select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM
|
select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM
|
||||||
select PSA_WANT_ALG_ECDH
|
select PSA_WANT_ALG_ECDH
|
||||||
|
|
@ -1008,19 +1001,11 @@ config BT_SEND_ECC_EMULATION
|
||||||
select PSA_WANT_ECC_SECP_R1_256
|
select PSA_WANT_ECC_SECP_R1_256
|
||||||
imply MBEDTLS_PSA_P256M_DRIVER_ENABLED if MBEDTLS_PSA_CRYPTO_C
|
imply MBEDTLS_PSA_P256M_DRIVER_ENABLED if MBEDTLS_PSA_CRYPTO_C
|
||||||
select BT_LONG_WQ
|
select BT_LONG_WQ
|
||||||
depends on BT_ECC && (BT_HCI_RAW || BT_HCI_HOST)
|
|
||||||
default y if HAS_BT_CTLR && !BT_CTLR_ECDH
|
|
||||||
help
|
help
|
||||||
If this option is set PSA Crypto API library is used for emulating the
|
If this option is set PSA Crypto API library is used for performing ECDH
|
||||||
ECDH HCI commands and events needed by e.g. LE Secure Connections.
|
operations needed e.g. by LE Secure Connections.
|
||||||
In builds including the BLE Host, if not set the controller crypto is
|
|
||||||
used for ECDH and if the controller doesn't support the required HCI
|
endif # BT_HCI_HOST
|
||||||
commands the LE Secure Connections support will be disabled.
|
|
||||||
In builds including the HCI Raw interface and the BLE Controller, this
|
|
||||||
option injects support for the 2 HCI commands required for LE Secure
|
|
||||||
Connections so that Hosts can make use of those. The option defaults
|
|
||||||
to enabled for a combined build with Zephyr's own controller, since it
|
|
||||||
does not have any special ECC support itself (at least not currently).
|
|
||||||
|
|
||||||
config BT_HOST_CCM
|
config BT_HOST_CCM
|
||||||
bool "Host side AES-CCM module"
|
bool "Host side AES-CCM module"
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include <psa/crypto.h>
|
#include <psa/crypto.h>
|
||||||
|
|
||||||
|
#include "long_wq.h"
|
||||||
#include "ecc.h"
|
#include "ecc.h"
|
||||||
#include "hci_core.h"
|
#include "hci_core.h"
|
||||||
|
|
||||||
|
|
@ -24,6 +25,38 @@ static uint8_t pub_key[BT_PUB_KEY_LEN];
|
||||||
static sys_slist_t pub_key_cb_slist;
|
static sys_slist_t pub_key_cb_slist;
|
||||||
static bt_dh_key_cb_t dh_key_cb;
|
static bt_dh_key_cb_t dh_key_cb;
|
||||||
|
|
||||||
|
static void generate_pub_key(struct k_work *work);
|
||||||
|
static void generate_dh_key(struct k_work *work);
|
||||||
|
K_WORK_DEFINE(pub_key_work, generate_pub_key);
|
||||||
|
K_WORK_DEFINE(dh_key_work, generate_dh_key);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PENDING_PUB_KEY,
|
||||||
|
PENDING_DHKEY,
|
||||||
|
|
||||||
|
/* Total number of flags - must be at the end of the enum */
|
||||||
|
NUM_FLAGS,
|
||||||
|
};
|
||||||
|
|
||||||
|
static ATOMIC_DEFINE(flags, NUM_FLAGS);
|
||||||
|
|
||||||
|
static struct {
|
||||||
|
uint8_t private_key_be[BT_PRIV_KEY_LEN];
|
||||||
|
|
||||||
|
union {
|
||||||
|
uint8_t public_key_be[BT_PUB_KEY_LEN];
|
||||||
|
uint8_t dhkey_be[BT_DH_KEY_LEN];
|
||||||
|
};
|
||||||
|
} ecc;
|
||||||
|
|
||||||
|
/* based on Core Specification 4.2 Vol 3. Part H 2.3.5.6.1 */
|
||||||
|
static const uint8_t debug_private_key_be[BT_PRIV_KEY_LEN] = {
|
||||||
|
0x3f, 0x49, 0xf6, 0xd4, 0xa3, 0xc5, 0x5f, 0x38,
|
||||||
|
0x74, 0xc9, 0xb3, 0xe3, 0xd2, 0x10, 0x3f, 0x50,
|
||||||
|
0x4a, 0xff, 0x60, 0x7b, 0xeb, 0x40, 0xb7, 0x99,
|
||||||
|
0x58, 0x99, 0xb8, 0xa6, 0xcd, 0x3c, 0x1a, 0xbd,
|
||||||
|
};
|
||||||
|
|
||||||
static const uint8_t debug_public_key[BT_PUB_KEY_LEN] = {
|
static const uint8_t debug_public_key[BT_PUB_KEY_LEN] = {
|
||||||
/* X */
|
/* X */
|
||||||
0xe6, 0x9d, 0x35, 0x0e, 0x48, 0x01, 0x03, 0xcc,
|
0xe6, 0x9d, 0x35, 0x0e, 0x48, 0x01, 0x03, 0xcc,
|
||||||
|
|
@ -71,22 +104,145 @@ bool bt_pub_key_is_valid(const uint8_t key[BT_PUB_KEY_LEN])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_key_attributes(psa_key_attributes_t *attr)
|
||||||
|
{
|
||||||
|
psa_set_key_type(attr, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1));
|
||||||
|
psa_set_key_bits(attr, 256);
|
||||||
|
psa_set_key_usage_flags(attr, PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_DERIVE);
|
||||||
|
psa_set_key_algorithm(attr, PSA_ALG_ECDH);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void generate_pub_key(struct k_work *work)
|
||||||
|
{
|
||||||
|
psa_key_attributes_t attr = PSA_KEY_ATTRIBUTES_INIT;
|
||||||
|
struct bt_pub_key_cb *cb;
|
||||||
|
psa_key_id_t key_id;
|
||||||
|
uint8_t tmp_pub_key_buf[BT_PUB_KEY_LEN + 1];
|
||||||
|
size_t tmp_len;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
set_key_attributes(&attr);
|
||||||
|
|
||||||
|
if (psa_generate_key(&attr, &key_id) != PSA_SUCCESS) {
|
||||||
|
LOG_ERR("Failed to generate ECC key");
|
||||||
|
err = BT_HCI_ERR_UNSPECIFIED;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (psa_export_public_key(key_id, tmp_pub_key_buf, sizeof(tmp_pub_key_buf),
|
||||||
|
&tmp_len) != PSA_SUCCESS) {
|
||||||
|
LOG_ERR("Failed to export ECC public key");
|
||||||
|
err = BT_HCI_ERR_UNSPECIFIED;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
/* secp256r1 PSA exported public key has an extra 0x04 predefined byte at
|
||||||
|
* the beginning of the buffer which is not part of the coordinate so
|
||||||
|
* we remove that.
|
||||||
|
*/
|
||||||
|
memcpy(ecc.public_key_be, &tmp_pub_key_buf[1], BT_PUB_KEY_LEN);
|
||||||
|
|
||||||
|
if (psa_export_key(key_id, ecc.private_key_be, BT_PRIV_KEY_LEN,
|
||||||
|
&tmp_len) != PSA_SUCCESS) {
|
||||||
|
LOG_ERR("Failed to export ECC private key");
|
||||||
|
err = BT_HCI_ERR_UNSPECIFIED;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (psa_destroy_key(key_id) != PSA_SUCCESS) {
|
||||||
|
LOG_ERR("Failed to destroy ECC key ID");
|
||||||
|
err = BT_HCI_ERR_UNSPECIFIED;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
sys_memcpy_swap(pub_key, ecc.public_key_be, BT_PUB_KEY_COORD_LEN);
|
||||||
|
sys_memcpy_swap(&pub_key[BT_PUB_KEY_COORD_LEN],
|
||||||
|
&ecc.public_key_be[BT_PUB_KEY_COORD_LEN], BT_PUB_KEY_COORD_LEN);
|
||||||
|
|
||||||
|
atomic_set_bit(bt_dev.flags, BT_DEV_HAS_PUB_KEY);
|
||||||
|
err = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
atomic_clear_bit(flags, PENDING_PUB_KEY);
|
||||||
|
|
||||||
|
/* Change to cooperative priority while we do the callbacks */
|
||||||
|
k_sched_lock();
|
||||||
|
|
||||||
|
SYS_SLIST_FOR_EACH_CONTAINER(&pub_key_cb_slist, cb, node) {
|
||||||
|
if (cb->func) {
|
||||||
|
cb->func(err ? NULL : pub_key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sys_slist_init(&pub_key_cb_slist);
|
||||||
|
|
||||||
|
k_sched_unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void generate_dh_key(struct k_work *work)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
psa_key_attributes_t attr = PSA_KEY_ATTRIBUTES_INIT;
|
||||||
|
psa_key_id_t key_id;
|
||||||
|
/* PSA expects secp256r1 public key to start with a predefined 0x04 byte
|
||||||
|
* at the beginning the buffer.
|
||||||
|
*/
|
||||||
|
uint8_t tmp_pub_key_buf[BT_PUB_KEY_LEN + 1] = { 0x04 };
|
||||||
|
size_t tmp_len;
|
||||||
|
|
||||||
|
set_key_attributes(&attr);
|
||||||
|
|
||||||
|
const uint8_t *priv_key = (IS_ENABLED(CONFIG_BT_USE_DEBUG_KEYS) ?
|
||||||
|
debug_private_key_be :
|
||||||
|
ecc.private_key_be);
|
||||||
|
if (psa_import_key(&attr, priv_key, BT_PRIV_KEY_LEN, &key_id) != PSA_SUCCESS) {
|
||||||
|
err = -EIO;
|
||||||
|
LOG_ERR("Failed to import the private key for key agreement");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(&tmp_pub_key_buf[1], ecc.public_key_be, BT_PUB_KEY_LEN);
|
||||||
|
if (psa_raw_key_agreement(PSA_ALG_ECDH, key_id, tmp_pub_key_buf,
|
||||||
|
sizeof(tmp_pub_key_buf), ecc.dhkey_be, BT_DH_KEY_LEN,
|
||||||
|
&tmp_len) != PSA_SUCCESS) {
|
||||||
|
err = -EIO;
|
||||||
|
LOG_ERR("Raw key agreement failed");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (psa_destroy_key(key_id) != PSA_SUCCESS) {
|
||||||
|
LOG_ERR("Failed to destroy the key");
|
||||||
|
err = -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = 0;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
/* Change to cooperative priority while we do the callback */
|
||||||
|
k_sched_lock();
|
||||||
|
|
||||||
|
if (dh_key_cb) {
|
||||||
|
bt_dh_key_cb_t cb = dh_key_cb;
|
||||||
|
|
||||||
|
dh_key_cb = NULL;
|
||||||
|
atomic_clear_bit(flags, PENDING_DHKEY);
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
cb(NULL);
|
||||||
|
} else {
|
||||||
|
uint8_t dhkey[BT_DH_KEY_LEN];
|
||||||
|
|
||||||
|
sys_memcpy_swap(dhkey, ecc.dhkey_be, sizeof(ecc.dhkey_be));
|
||||||
|
cb(dhkey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
k_sched_unlock();
|
||||||
|
}
|
||||||
|
|
||||||
int bt_pub_key_gen(struct bt_pub_key_cb *new_cb)
|
int bt_pub_key_gen(struct bt_pub_key_cb *new_cb)
|
||||||
{
|
{
|
||||||
struct bt_pub_key_cb *cb;
|
struct bt_pub_key_cb *cb;
|
||||||
int err;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We check for both "LE Read Local P-256 Public Key" and
|
|
||||||
* "LE Generate DH Key" support here since both commands are needed for
|
|
||||||
* ECC support. If "LE Generate DH Key" is not supported then there
|
|
||||||
* is no point in reading local public key.
|
|
||||||
*/
|
|
||||||
if (!BT_CMD_TEST(bt_dev.supported_commands, 34, 1) ||
|
|
||||||
!BT_CMD_TEST(bt_dev.supported_commands, 34, 2)) {
|
|
||||||
LOG_WRN("ECC HCI commands not available");
|
|
||||||
return -ENOTSUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_USE_DEBUG_KEYS)) {
|
if (IS_ENABLED(CONFIG_BT_USE_DEBUG_KEYS)) {
|
||||||
if (!BT_CMD_TEST(bt_dev.supported_commands, 41, 2)) {
|
if (!BT_CMD_TEST(bt_dev.supported_commands, 41, 2)) {
|
||||||
|
|
@ -110,29 +266,20 @@ int bt_pub_key_gen(struct bt_pub_key_cb *new_cb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (atomic_test_bit(flags, PENDING_DHKEY)) {
|
||||||
|
LOG_WRN("Busy performing another ECDH operation");
|
||||||
|
return -EBUSY;
|
||||||
|
}
|
||||||
|
|
||||||
sys_slist_prepend(&pub_key_cb_slist, &new_cb->node);
|
sys_slist_prepend(&pub_key_cb_slist, &new_cb->node);
|
||||||
|
|
||||||
if (atomic_test_and_set_bit(bt_dev.flags, BT_DEV_PUB_KEY_BUSY)) {
|
if (atomic_test_and_set_bit(flags, PENDING_PUB_KEY)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic_clear_bit(bt_dev.flags, BT_DEV_HAS_PUB_KEY);
|
atomic_clear_bit(bt_dev.flags, BT_DEV_HAS_PUB_KEY);
|
||||||
|
|
||||||
err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_P256_PUBLIC_KEY, NULL, NULL);
|
bt_long_wq_submit(&pub_key_work);
|
||||||
if (err) {
|
|
||||||
|
|
||||||
LOG_ERR("Sending LE P256 Public Key command failed");
|
|
||||||
atomic_clear_bit(bt_dev.flags, BT_DEV_PUB_KEY_BUSY);
|
|
||||||
|
|
||||||
SYS_SLIST_FOR_EACH_CONTAINER(&pub_key_cb_slist, cb, node) {
|
|
||||||
if (cb->func) {
|
|
||||||
cb->func(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sys_slist_init(&pub_key_cb_slist);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -141,7 +288,7 @@ void bt_pub_key_hci_disrupted(void)
|
||||||
{
|
{
|
||||||
struct bt_pub_key_cb *cb;
|
struct bt_pub_key_cb *cb;
|
||||||
|
|
||||||
atomic_clear_bit(bt_dev.flags, BT_DEV_PUB_KEY_BUSY);
|
atomic_clear_bit(flags, PENDING_PUB_KEY);
|
||||||
|
|
||||||
SYS_SLIST_FOR_EACH_CONTAINER(&pub_key_cb_slist, cb, node) {
|
SYS_SLIST_FOR_EACH_CONTAINER(&pub_key_cb_slist, cb, node) {
|
||||||
if (cb->func) {
|
if (cb->func) {
|
||||||
|
|
@ -166,111 +313,36 @@ const uint8_t *bt_pub_key_get(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hci_generate_dhkey_v1(const uint8_t *remote_pk)
|
|
||||||
{
|
|
||||||
struct bt_hci_cp_le_generate_dhkey *cp;
|
|
||||||
struct net_buf *buf;
|
|
||||||
|
|
||||||
buf = bt_hci_cmd_create(BT_HCI_OP_LE_GENERATE_DHKEY, sizeof(*cp));
|
|
||||||
if (!buf) {
|
|
||||||
return -ENOBUFS;
|
|
||||||
}
|
|
||||||
|
|
||||||
cp = net_buf_add(buf, sizeof(*cp));
|
|
||||||
memcpy(cp->key, remote_pk, sizeof(cp->key));
|
|
||||||
|
|
||||||
return bt_hci_cmd_send_sync(BT_HCI_OP_LE_GENERATE_DHKEY, buf, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int hci_generate_dhkey_v2(const uint8_t *remote_pk, uint8_t key_type)
|
|
||||||
{
|
|
||||||
struct bt_hci_cp_le_generate_dhkey_v2 *cp;
|
|
||||||
struct net_buf *buf;
|
|
||||||
|
|
||||||
buf = bt_hci_cmd_create(BT_HCI_OP_LE_GENERATE_DHKEY_V2, sizeof(*cp));
|
|
||||||
if (!buf) {
|
|
||||||
return -ENOBUFS;
|
|
||||||
}
|
|
||||||
|
|
||||||
cp = net_buf_add(buf, sizeof(*cp));
|
|
||||||
memcpy(cp->key, remote_pk, sizeof(cp->key));
|
|
||||||
cp->key_type = key_type;
|
|
||||||
|
|
||||||
return bt_hci_cmd_send_sync(BT_HCI_OP_LE_GENERATE_DHKEY_V2, buf, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
int bt_dh_key_gen(const uint8_t remote_pk[BT_PUB_KEY_LEN], bt_dh_key_cb_t cb)
|
int bt_dh_key_gen(const uint8_t remote_pk[BT_PUB_KEY_LEN], bt_dh_key_cb_t cb)
|
||||||
{
|
{
|
||||||
int err;
|
|
||||||
|
|
||||||
if (dh_key_cb == cb) {
|
if (dh_key_cb == cb) {
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dh_key_cb || atomic_test_bit(bt_dev.flags, BT_DEV_PUB_KEY_BUSY)) {
|
|
||||||
return -EBUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!atomic_test_bit(bt_dev.flags, BT_DEV_HAS_PUB_KEY)) {
|
if (!atomic_test_bit(bt_dev.flags, BT_DEV_HAS_PUB_KEY)) {
|
||||||
return -EADDRNOTAVAIL;
|
return -EADDRNOTAVAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dh_key_cb ||
|
||||||
|
atomic_test_bit(flags, PENDING_PUB_KEY) ||
|
||||||
|
atomic_test_and_set_bit(flags, PENDING_DHKEY)) {
|
||||||
|
return -EBUSY;
|
||||||
|
}
|
||||||
|
|
||||||
dh_key_cb = cb;
|
dh_key_cb = cb;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_USE_DEBUG_KEYS) &&
|
/* Convert X and Y coordinates from little-endian to
|
||||||
BT_CMD_TEST(bt_dev.supported_commands, 41, 2)) {
|
* big-endian (expected by the crypto API).
|
||||||
err = hci_generate_dhkey_v2(remote_pk,
|
*/
|
||||||
BT_HCI_LE_KEY_TYPE_DEBUG);
|
sys_memcpy_swap(ecc.public_key_be, remote_pk, BT_PUB_KEY_COORD_LEN);
|
||||||
} else {
|
sys_memcpy_swap(&ecc.public_key_be[BT_PUB_KEY_COORD_LEN],
|
||||||
err = hci_generate_dhkey_v1(remote_pk);
|
&remote_pk[BT_PUB_KEY_COORD_LEN], BT_PUB_KEY_COORD_LEN);
|
||||||
}
|
|
||||||
|
|
||||||
if (err) {
|
bt_long_wq_submit(&dh_key_work);
|
||||||
dh_key_cb = NULL;
|
|
||||||
LOG_WRN("Failed to generate DHKey (err %d)", err);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bt_hci_evt_le_pkey_complete(struct net_buf *buf)
|
|
||||||
{
|
|
||||||
struct bt_hci_evt_le_p256_public_key_complete *evt = (void *)buf->data;
|
|
||||||
struct bt_pub_key_cb *cb;
|
|
||||||
|
|
||||||
LOG_DBG("status: 0x%02x %s", evt->status, bt_hci_err_to_str(evt->status));
|
|
||||||
|
|
||||||
atomic_clear_bit(bt_dev.flags, BT_DEV_PUB_KEY_BUSY);
|
|
||||||
|
|
||||||
if (!evt->status) {
|
|
||||||
memcpy(pub_key, evt->key, BT_PUB_KEY_LEN);
|
|
||||||
atomic_set_bit(bt_dev.flags, BT_DEV_HAS_PUB_KEY);
|
|
||||||
}
|
|
||||||
|
|
||||||
SYS_SLIST_FOR_EACH_CONTAINER(&pub_key_cb_slist, cb, node) {
|
|
||||||
if (cb->func) {
|
|
||||||
cb->func(evt->status ? NULL : pub_key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sys_slist_init(&pub_key_cb_slist);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bt_hci_evt_le_dhkey_complete(struct net_buf *buf)
|
|
||||||
{
|
|
||||||
struct bt_hci_evt_le_generate_dhkey_complete *evt = (void *)buf->data;
|
|
||||||
|
|
||||||
LOG_DBG("status: 0x%02x %s", evt->status, bt_hci_err_to_str(evt->status));
|
|
||||||
|
|
||||||
if (dh_key_cb) {
|
|
||||||
bt_dh_key_cb_t cb = dh_key_cb;
|
|
||||||
|
|
||||||
dh_key_cb = NULL;
|
|
||||||
cb(evt->status ? NULL : evt->dhkey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ZTEST_UNITTEST
|
#ifdef ZTEST_UNITTEST
|
||||||
uint8_t const *bt_ecc_get_public_key(void)
|
uint8_t const *bt_ecc_get_public_key(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@
|
||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
#include "monitor.h"
|
#include "monitor.h"
|
||||||
#include "hci_core.h"
|
#include "hci_core.h"
|
||||||
#include "hci_ecc.h"
|
|
||||||
#include "ecc.h"
|
#include "ecc.h"
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
#include "adv.h"
|
#include "adv.h"
|
||||||
|
|
@ -2757,14 +2756,6 @@ static const struct event_handler meta_events[] = {
|
||||||
EVENT_HANDLER(BT_HCI_EVT_LE_LTK_REQUEST, le_ltk_request,
|
EVENT_HANDLER(BT_HCI_EVT_LE_LTK_REQUEST, le_ltk_request,
|
||||||
sizeof(struct bt_hci_evt_le_ltk_request)),
|
sizeof(struct bt_hci_evt_le_ltk_request)),
|
||||||
#endif /* CONFIG_BT_SMP */
|
#endif /* CONFIG_BT_SMP */
|
||||||
#if defined(CONFIG_BT_ECC)
|
|
||||||
EVENT_HANDLER(BT_HCI_EVT_LE_P256_PUBLIC_KEY_COMPLETE,
|
|
||||||
bt_hci_evt_le_pkey_complete,
|
|
||||||
sizeof(struct bt_hci_evt_le_p256_public_key_complete)),
|
|
||||||
EVENT_HANDLER(BT_HCI_EVT_LE_GENERATE_DHKEY_COMPLETE,
|
|
||||||
bt_hci_evt_le_dhkey_complete,
|
|
||||||
sizeof(struct bt_hci_evt_le_generate_dhkey_complete)),
|
|
||||||
#endif /* CONFIG_BT_SMP */
|
|
||||||
#if defined(CONFIG_BT_EXT_ADV)
|
#if defined(CONFIG_BT_EXT_ADV)
|
||||||
#if defined(CONFIG_BT_BROADCASTER)
|
#if defined(CONFIG_BT_BROADCASTER)
|
||||||
EVENT_HANDLER(BT_HCI_EVT_LE_ADV_SET_TERMINATED, bt_hci_le_adv_set_terminated,
|
EVENT_HANDLER(BT_HCI_EVT_LE_ADV_SET_TERMINATED, bt_hci_le_adv_set_terminated,
|
||||||
|
|
@ -3209,15 +3200,7 @@ static void read_supported_commands_complete(struct net_buf *buf)
|
||||||
|
|
||||||
LOG_DBG("status 0x%02x %s", rp->status, bt_hci_err_to_str(rp->status));
|
LOG_DBG("status 0x%02x %s", rp->status, bt_hci_err_to_str(rp->status));
|
||||||
|
|
||||||
memcpy(bt_dev.supported_commands, rp->commands,
|
memcpy(bt_dev.supported_commands, rp->commands, sizeof(bt_dev.supported_commands));
|
||||||
sizeof(bt_dev.supported_commands));
|
|
||||||
|
|
||||||
/* Report additional HCI commands used for ECDH as
|
|
||||||
* supported if PSA Crypto API ECC is used for emulation.
|
|
||||||
*/
|
|
||||||
if (IS_ENABLED(CONFIG_BT_SEND_ECC_EMULATION)) {
|
|
||||||
bt_hci_ecc_supported_commands(bt_dev.supported_commands);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_local_features_complete(struct net_buf *buf)
|
static void read_local_features_complete(struct net_buf *buf)
|
||||||
|
|
@ -3402,17 +3385,6 @@ static int le_set_event_mask(void)
|
||||||
mask |= BT_EVT_MASK_LE_LTK_REQUEST;
|
mask |= BT_EVT_MASK_LE_LTK_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* If "LE Read Local P-256 Public Key" and "LE Generate DH Key" are
|
|
||||||
* supported we need to enable events generated by those commands.
|
|
||||||
*/
|
|
||||||
if (IS_ENABLED(CONFIG_BT_ECC) &&
|
|
||||||
(BT_CMD_TEST(bt_dev.supported_commands, 34, 1)) &&
|
|
||||||
(BT_CMD_TEST(bt_dev.supported_commands, 34, 2))) {
|
|
||||||
mask |= BT_EVT_MASK_LE_P256_PUBLIC_KEY_COMPLETE;
|
|
||||||
mask |= BT_EVT_MASK_LE_GENERATE_DHKEY_COMPLETE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable CIS events only if ISO connections are enabled and controller
|
* Enable CIS events only if ISO connections are enabled and controller
|
||||||
* support them.
|
* support them.
|
||||||
|
|
@ -4059,10 +4031,6 @@ int bt_send(struct net_buf *buf)
|
||||||
|
|
||||||
bt_monitor_send(bt_monitor_opcode(buf), buf->data, buf->len);
|
bt_monitor_send(bt_monitor_opcode(buf), buf->data, buf->len);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_SEND_ECC_EMULATION)) {
|
|
||||||
return bt_hci_ecc_send(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
return bt_hci_send(bt_dev.hci, buf);
|
return bt_hci_send(bt_dev.hci, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ enum {
|
||||||
BT_DEV_READY,
|
BT_DEV_READY,
|
||||||
BT_DEV_PRESET_ID,
|
BT_DEV_PRESET_ID,
|
||||||
BT_DEV_HAS_PUB_KEY,
|
BT_DEV_HAS_PUB_KEY,
|
||||||
BT_DEV_PUB_KEY_BUSY,
|
|
||||||
|
|
||||||
/** The application either explicitly or implicitly instructed the stack to scan
|
/** The application either explicitly or implicitly instructed the stack to scan
|
||||||
* for advertisers.
|
* for advertisers.
|
||||||
|
|
@ -509,10 +508,6 @@ void bt_hci_user_passkey_notify(struct net_buf *buf);
|
||||||
void bt_hci_user_passkey_req(struct net_buf *buf);
|
void bt_hci_user_passkey_req(struct net_buf *buf);
|
||||||
void bt_hci_auth_complete(struct net_buf *buf);
|
void bt_hci_auth_complete(struct net_buf *buf);
|
||||||
|
|
||||||
/* ECC HCI event handlers */
|
|
||||||
void bt_hci_evt_le_pkey_complete(struct net_buf *buf);
|
|
||||||
void bt_hci_evt_le_dhkey_complete(struct net_buf *buf);
|
|
||||||
|
|
||||||
/* Common HCI event handlers */
|
/* Common HCI event handlers */
|
||||||
void bt_hci_le_enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt);
|
void bt_hci_le_enh_conn_complete(struct bt_hci_evt_le_enh_conn_complete *evt);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,390 +0,0 @@
|
||||||
/**
|
|
||||||
* @file hci_ecc.c
|
|
||||||
* HCI ECC emulation
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2016 Intel Corporation
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <zephyr/kernel.h>
|
|
||||||
#include <zephyr/sys/atomic.h>
|
|
||||||
#include <zephyr/debug/stack.h>
|
|
||||||
#include <zephyr/sys/byteorder.h>
|
|
||||||
|
|
||||||
#include <psa/crypto.h>
|
|
||||||
|
|
||||||
#include <zephyr/bluetooth/bluetooth.h>
|
|
||||||
#include <zephyr/bluetooth/buf.h>
|
|
||||||
#include <zephyr/bluetooth/conn.h>
|
|
||||||
#include <zephyr/bluetooth/hci.h>
|
|
||||||
#include <zephyr/drivers/bluetooth.h>
|
|
||||||
|
|
||||||
#include "common/bt_str.h"
|
|
||||||
|
|
||||||
#include "hci_ecc.h"
|
|
||||||
#include "ecc.h"
|
|
||||||
|
|
||||||
#ifdef CONFIG_BT_HCI_RAW
|
|
||||||
#include <zephyr/bluetooth/hci_raw.h>
|
|
||||||
#include "hci_raw_internal.h"
|
|
||||||
#else
|
|
||||||
#include "hci_core.h"
|
|
||||||
#endif
|
|
||||||
#include "long_wq.h"
|
|
||||||
|
|
||||||
#define LOG_LEVEL CONFIG_BT_HCI_CORE_LOG_LEVEL
|
|
||||||
#include <zephyr/logging/log.h>
|
|
||||||
LOG_MODULE_REGISTER(bt_hci_ecc);
|
|
||||||
|
|
||||||
static void ecc_process(struct k_work *work);
|
|
||||||
K_WORK_DEFINE(ecc_work, ecc_process);
|
|
||||||
|
|
||||||
/* based on Core Specification 4.2 Vol 3. Part H 2.3.5.6.1 */
|
|
||||||
static const uint8_t debug_private_key_be[BT_PRIV_KEY_LEN] = {
|
|
||||||
0x3f, 0x49, 0xf6, 0xd4, 0xa3, 0xc5, 0x5f, 0x38,
|
|
||||||
0x74, 0xc9, 0xb3, 0xe3, 0xd2, 0x10, 0x3f, 0x50,
|
|
||||||
0x4a, 0xff, 0x60, 0x7b, 0xeb, 0x40, 0xb7, 0x99,
|
|
||||||
0x58, 0x99, 0xb8, 0xa6, 0xcd, 0x3c, 0x1a, 0xbd,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PENDING_PUB_KEY,
|
|
||||||
PENDING_DHKEY,
|
|
||||||
|
|
||||||
USE_DEBUG_KEY,
|
|
||||||
|
|
||||||
/* Total number of flags - must be at the end of the enum */
|
|
||||||
NUM_FLAGS,
|
|
||||||
};
|
|
||||||
|
|
||||||
static ATOMIC_DEFINE(flags, NUM_FLAGS);
|
|
||||||
|
|
||||||
static struct {
|
|
||||||
uint8_t private_key_be[BT_PRIV_KEY_LEN];
|
|
||||||
|
|
||||||
union {
|
|
||||||
uint8_t public_key_be[BT_PUB_KEY_LEN];
|
|
||||||
uint8_t dhkey_be[BT_DH_KEY_LEN];
|
|
||||||
};
|
|
||||||
} ecc;
|
|
||||||
|
|
||||||
static void send_cmd_status(uint16_t opcode, uint8_t status)
|
|
||||||
{
|
|
||||||
struct bt_hci_evt_cmd_status *evt;
|
|
||||||
struct bt_hci_evt_hdr *hdr;
|
|
||||||
struct net_buf *buf;
|
|
||||||
|
|
||||||
LOG_DBG("opcode %x status 0x%02x %s", opcode, status, bt_hci_err_to_str(status));
|
|
||||||
|
|
||||||
buf = bt_buf_get_evt(BT_HCI_EVT_CMD_STATUS, false, K_FOREVER);
|
|
||||||
bt_buf_set_type(buf, BT_BUF_EVT);
|
|
||||||
|
|
||||||
hdr = net_buf_add(buf, sizeof(*hdr));
|
|
||||||
hdr->evt = BT_HCI_EVT_CMD_STATUS;
|
|
||||||
hdr->len = sizeof(*evt);
|
|
||||||
|
|
||||||
evt = net_buf_add(buf, sizeof(*evt));
|
|
||||||
evt->ncmd = 1U;
|
|
||||||
evt->opcode = sys_cpu_to_le16(opcode);
|
|
||||||
evt->status = status;
|
|
||||||
|
|
||||||
bt_hci_recv(bt_dev.hci, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void set_key_attributes(psa_key_attributes_t *attr)
|
|
||||||
{
|
|
||||||
psa_set_key_type(attr, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1));
|
|
||||||
psa_set_key_bits(attr, 256);
|
|
||||||
psa_set_key_usage_flags(attr, PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_DERIVE);
|
|
||||||
psa_set_key_algorithm(attr, PSA_ALG_ECDH);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint8_t generate_keys(void)
|
|
||||||
{
|
|
||||||
psa_key_attributes_t attr = PSA_KEY_ATTRIBUTES_INIT;
|
|
||||||
psa_key_id_t key_id;
|
|
||||||
uint8_t tmp_pub_key_buf[BT_PUB_KEY_LEN + 1];
|
|
||||||
size_t tmp_len;
|
|
||||||
|
|
||||||
set_key_attributes(&attr);
|
|
||||||
|
|
||||||
if (psa_generate_key(&attr, &key_id) != PSA_SUCCESS) {
|
|
||||||
LOG_ERR("Failed to generate ECC key");
|
|
||||||
return BT_HCI_ERR_UNSPECIFIED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (psa_export_public_key(key_id, tmp_pub_key_buf, sizeof(tmp_pub_key_buf),
|
|
||||||
&tmp_len) != PSA_SUCCESS) {
|
|
||||||
LOG_ERR("Failed to export ECC public key");
|
|
||||||
return BT_HCI_ERR_UNSPECIFIED;
|
|
||||||
}
|
|
||||||
/* secp256r1 PSA exported public key has an extra 0x04 predefined byte at
|
|
||||||
* the beginning of the buffer which is not part of the coordinate so
|
|
||||||
* we remove that.
|
|
||||||
*/
|
|
||||||
memcpy(ecc.public_key_be, &tmp_pub_key_buf[1], BT_PUB_KEY_LEN);
|
|
||||||
|
|
||||||
if (psa_export_key(key_id, ecc.private_key_be, BT_PRIV_KEY_LEN,
|
|
||||||
&tmp_len) != PSA_SUCCESS) {
|
|
||||||
LOG_ERR("Failed to export ECC private key");
|
|
||||||
return BT_HCI_ERR_UNSPECIFIED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (psa_destroy_key(key_id) != PSA_SUCCESS) {
|
|
||||||
LOG_ERR("Failed to destroy ECC key ID");
|
|
||||||
return BT_HCI_ERR_UNSPECIFIED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void emulate_le_p256_public_key_cmd(void)
|
|
||||||
{
|
|
||||||
struct bt_hci_evt_le_p256_public_key_complete *evt;
|
|
||||||
struct bt_hci_evt_le_meta_event *meta;
|
|
||||||
struct bt_hci_evt_hdr *hdr;
|
|
||||||
struct net_buf *buf;
|
|
||||||
uint8_t status;
|
|
||||||
|
|
||||||
LOG_DBG("");
|
|
||||||
|
|
||||||
status = generate_keys();
|
|
||||||
|
|
||||||
buf = bt_buf_get_rx(BT_BUF_EVT, K_FOREVER);
|
|
||||||
|
|
||||||
hdr = net_buf_add(buf, sizeof(*hdr));
|
|
||||||
hdr->evt = BT_HCI_EVT_LE_META_EVENT;
|
|
||||||
hdr->len = sizeof(*meta) + sizeof(*evt);
|
|
||||||
|
|
||||||
meta = net_buf_add(buf, sizeof(*meta));
|
|
||||||
meta->subevent = BT_HCI_EVT_LE_P256_PUBLIC_KEY_COMPLETE;
|
|
||||||
|
|
||||||
evt = net_buf_add(buf, sizeof(*evt));
|
|
||||||
evt->status = status;
|
|
||||||
|
|
||||||
if (status) {
|
|
||||||
(void)memset(evt->key, 0, sizeof(evt->key));
|
|
||||||
} else {
|
|
||||||
/* Convert X and Y coordinates from big-endian (provided
|
|
||||||
* by crypto API) to little endian HCI.
|
|
||||||
*/
|
|
||||||
sys_memcpy_swap(evt->key, ecc.public_key_be, BT_PUB_KEY_COORD_LEN);
|
|
||||||
sys_memcpy_swap(&evt->key[BT_PUB_KEY_COORD_LEN],
|
|
||||||
&ecc.public_key_be[BT_PUB_KEY_COORD_LEN], BT_PUB_KEY_COORD_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
atomic_clear_bit(flags, PENDING_PUB_KEY);
|
|
||||||
|
|
||||||
bt_hci_recv(bt_dev.hci, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void emulate_le_generate_dhkey(void)
|
|
||||||
{
|
|
||||||
struct bt_hci_evt_le_generate_dhkey_complete *evt;
|
|
||||||
struct bt_hci_evt_le_meta_event *meta;
|
|
||||||
struct bt_hci_evt_hdr *hdr;
|
|
||||||
struct net_buf *buf;
|
|
||||||
int ret = 0;
|
|
||||||
bool use_debug = atomic_test_bit(flags, USE_DEBUG_KEY);
|
|
||||||
|
|
||||||
psa_key_attributes_t attr = PSA_KEY_ATTRIBUTES_INIT;
|
|
||||||
psa_key_id_t key_id;
|
|
||||||
/* PSA expects secp256r1 public key to start with a predefined 0x04 byte
|
|
||||||
* at the beginning the buffer.
|
|
||||||
*/
|
|
||||||
uint8_t tmp_pub_key_buf[BT_PUB_KEY_LEN + 1] = { 0x04 };
|
|
||||||
size_t tmp_len;
|
|
||||||
|
|
||||||
set_key_attributes(&attr);
|
|
||||||
|
|
||||||
if (psa_import_key(&attr, use_debug ? debug_private_key_be : ecc.private_key_be,
|
|
||||||
BT_PRIV_KEY_LEN, &key_id) != PSA_SUCCESS) {
|
|
||||||
ret = -EIO;
|
|
||||||
LOG_ERR("Failed to import the private key for key agreement");
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(&tmp_pub_key_buf[1], ecc.public_key_be, BT_PUB_KEY_LEN);
|
|
||||||
if (psa_raw_key_agreement(PSA_ALG_ECDH, key_id, tmp_pub_key_buf,
|
|
||||||
sizeof(tmp_pub_key_buf), ecc.dhkey_be, BT_DH_KEY_LEN,
|
|
||||||
&tmp_len) != PSA_SUCCESS) {
|
|
||||||
ret = -EIO;
|
|
||||||
LOG_ERR("Raw key agreement failed");
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (psa_destroy_key(key_id) != PSA_SUCCESS) {
|
|
||||||
LOG_ERR("Failed to destroy the key");
|
|
||||||
ret = -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
|
||||||
buf = bt_buf_get_rx(BT_BUF_EVT, K_FOREVER);
|
|
||||||
|
|
||||||
hdr = net_buf_add(buf, sizeof(*hdr));
|
|
||||||
hdr->evt = BT_HCI_EVT_LE_META_EVENT;
|
|
||||||
hdr->len = sizeof(*meta) + sizeof(*evt);
|
|
||||||
|
|
||||||
meta = net_buf_add(buf, sizeof(*meta));
|
|
||||||
meta->subevent = BT_HCI_EVT_LE_GENERATE_DHKEY_COMPLETE;
|
|
||||||
|
|
||||||
evt = net_buf_add(buf, sizeof(*evt));
|
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
evt->status = BT_HCI_ERR_UNSPECIFIED;
|
|
||||||
(void)memset(evt->dhkey, 0xff, sizeof(evt->dhkey));
|
|
||||||
} else {
|
|
||||||
evt->status = 0U;
|
|
||||||
/* Convert from big-endian (provided by crypto API) to
|
|
||||||
* little-endian HCI.
|
|
||||||
*/
|
|
||||||
sys_memcpy_swap(evt->dhkey, ecc.dhkey_be, sizeof(ecc.dhkey_be));
|
|
||||||
}
|
|
||||||
|
|
||||||
atomic_clear_bit(flags, PENDING_DHKEY);
|
|
||||||
|
|
||||||
bt_hci_recv(bt_dev.hci, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ecc_process(struct k_work *work)
|
|
||||||
{
|
|
||||||
if (atomic_test_bit(flags, PENDING_PUB_KEY)) {
|
|
||||||
emulate_le_p256_public_key_cmd();
|
|
||||||
} else if (atomic_test_bit(flags, PENDING_DHKEY)) {
|
|
||||||
emulate_le_generate_dhkey();
|
|
||||||
} else {
|
|
||||||
__ASSERT(0, "Unhandled ECC command");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void clear_ecc_events(struct net_buf *buf)
|
|
||||||
{
|
|
||||||
struct bt_hci_cp_le_set_event_mask *cmd;
|
|
||||||
|
|
||||||
cmd = (void *)(buf->data + sizeof(struct bt_hci_cmd_hdr));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* don't enable controller ECC events as those will be generated from
|
|
||||||
* emulation code
|
|
||||||
*/
|
|
||||||
cmd->events[0] &= ~0x80; /* LE Read Local P-256 PKey Compl */
|
|
||||||
cmd->events[1] &= ~0x01; /* LE Generate DHKey Compl Event */
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint8_t le_gen_dhkey(uint8_t *key, uint8_t key_type)
|
|
||||||
{
|
|
||||||
if (atomic_test_bit(flags, PENDING_PUB_KEY)) {
|
|
||||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key_type > BT_HCI_LE_KEY_TYPE_DEBUG) {
|
|
||||||
return BT_HCI_ERR_INVALID_PARAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (atomic_test_and_set_bit(flags, PENDING_DHKEY)) {
|
|
||||||
return BT_HCI_ERR_CMD_DISALLOWED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert X and Y coordinates from little-endian HCI to
|
|
||||||
* big-endian (expected by the crypto API).
|
|
||||||
*/
|
|
||||||
sys_memcpy_swap(ecc.public_key_be, key, BT_PUB_KEY_COORD_LEN);
|
|
||||||
sys_memcpy_swap(&ecc.public_key_be[BT_PUB_KEY_COORD_LEN], &key[BT_PUB_KEY_COORD_LEN],
|
|
||||||
BT_PUB_KEY_COORD_LEN);
|
|
||||||
|
|
||||||
atomic_set_bit_to(flags, USE_DEBUG_KEY,
|
|
||||||
key_type == BT_HCI_LE_KEY_TYPE_DEBUG);
|
|
||||||
|
|
||||||
bt_long_wq_submit(&ecc_work);
|
|
||||||
|
|
||||||
return BT_HCI_ERR_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void le_gen_dhkey_v1(struct net_buf *buf)
|
|
||||||
{
|
|
||||||
struct bt_hci_cp_le_generate_dhkey *cmd;
|
|
||||||
uint8_t status;
|
|
||||||
|
|
||||||
cmd = (void *)buf->data;
|
|
||||||
status = le_gen_dhkey(cmd->key, BT_HCI_LE_KEY_TYPE_GENERATED);
|
|
||||||
|
|
||||||
net_buf_unref(buf);
|
|
||||||
send_cmd_status(BT_HCI_OP_LE_GENERATE_DHKEY, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void le_gen_dhkey_v2(struct net_buf *buf)
|
|
||||||
{
|
|
||||||
struct bt_hci_cp_le_generate_dhkey_v2 *cmd;
|
|
||||||
uint8_t status;
|
|
||||||
|
|
||||||
cmd = (void *)buf->data;
|
|
||||||
status = le_gen_dhkey(cmd->key, cmd->key_type);
|
|
||||||
|
|
||||||
net_buf_unref(buf);
|
|
||||||
send_cmd_status(BT_HCI_OP_LE_GENERATE_DHKEY_V2, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void le_p256_pub_key(struct net_buf *buf)
|
|
||||||
{
|
|
||||||
uint8_t status;
|
|
||||||
|
|
||||||
net_buf_unref(buf);
|
|
||||||
|
|
||||||
if (atomic_test_bit(flags, PENDING_DHKEY)) {
|
|
||||||
status = BT_HCI_ERR_CMD_DISALLOWED;
|
|
||||||
} else if (atomic_test_and_set_bit(flags, PENDING_PUB_KEY)) {
|
|
||||||
status = BT_HCI_ERR_CMD_DISALLOWED;
|
|
||||||
} else {
|
|
||||||
bt_long_wq_submit(&ecc_work);
|
|
||||||
status = BT_HCI_ERR_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
send_cmd_status(BT_HCI_OP_LE_P256_PUBLIC_KEY, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
int bt_hci_ecc_send(struct net_buf *buf)
|
|
||||||
{
|
|
||||||
if (bt_buf_get_type(buf) == BT_BUF_CMD) {
|
|
||||||
struct bt_hci_cmd_hdr *chdr = (void *)buf->data;
|
|
||||||
|
|
||||||
switch (sys_le16_to_cpu(chdr->opcode)) {
|
|
||||||
case BT_HCI_OP_LE_P256_PUBLIC_KEY:
|
|
||||||
net_buf_pull(buf, sizeof(*chdr));
|
|
||||||
le_p256_pub_key(buf);
|
|
||||||
return 0;
|
|
||||||
case BT_HCI_OP_LE_GENERATE_DHKEY:
|
|
||||||
net_buf_pull(buf, sizeof(*chdr));
|
|
||||||
le_gen_dhkey_v1(buf);
|
|
||||||
return 0;
|
|
||||||
case BT_HCI_OP_LE_GENERATE_DHKEY_V2:
|
|
||||||
net_buf_pull(buf, sizeof(*chdr));
|
|
||||||
le_gen_dhkey_v2(buf);
|
|
||||||
return 0;
|
|
||||||
case BT_HCI_OP_LE_SET_EVENT_MASK:
|
|
||||||
clear_ecc_events(buf);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return bt_hci_send(bt_dev.hci, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bt_hci_ecc_supported_commands(uint8_t *supported_commands)
|
|
||||||
{
|
|
||||||
/* LE Read Local P-256 Public Key */
|
|
||||||
supported_commands[34] |= BIT(1);
|
|
||||||
/* LE Generate DH Key v1 */
|
|
||||||
supported_commands[34] |= BIT(2);
|
|
||||||
/* LE Generate DH Key v2 */
|
|
||||||
supported_commands[41] |= BIT(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
int default_CSPRNG(uint8_t *dst, unsigned int len)
|
|
||||||
{
|
|
||||||
return !bt_rand(dst, len);
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
/* hci_ecc.h - HCI ECC emulation */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2016 Intel Corporation
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
int bt_hci_ecc_send(struct net_buf *buf);
|
|
||||||
void bt_hci_ecc_supported_commands(uint8_t *supported_commands);
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include <zephyr/bluetooth/hci.h>
|
#include <zephyr/bluetooth/hci.h>
|
||||||
|
|
||||||
#include "hci_ecc.h"
|
|
||||||
#include "monitor.h"
|
#include "monitor.h"
|
||||||
#include "hci_raw_internal.h"
|
#include "hci_raw_internal.h"
|
||||||
|
|
||||||
|
|
@ -313,10 +312,6 @@ int bt_send(struct net_buf *buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_SEND_ECC_EMULATION)) {
|
|
||||||
return bt_hci_ecc_send(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
return bt_hci_send(bt_dev.hci, buf);
|
return bt_hci_send(bt_dev.hci, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -298,17 +298,11 @@ static K_SEM_DEFINE(sc_local_pkey_ready, 0, 1);
|
||||||
|
|
||||||
static bool le_sc_supported(void)
|
static bool le_sc_supported(void)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* If controller based ECC is to be used it must support
|
|
||||||
* "LE Read Local P-256 Public Key" and "LE Generate DH Key" commands.
|
|
||||||
* Otherwise LE SC are not supported.
|
|
||||||
*/
|
|
||||||
if (IS_ENABLED(CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY)) {
|
if (IS_ENABLED(CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return BT_CMD_TEST(bt_dev.supported_commands, 34, 1) &&
|
return IS_ENABLED(CONFIG_BT_ECC);
|
||||||
BT_CMD_TEST(bt_dev.supported_commands, 34, 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct bt_conn_auth_cb *latch_auth_cb(struct bt_smp *smp)
|
static const struct bt_conn_auth_cb *latch_auth_cb(struct bt_smp *smp)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,5 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_USE_DEBUG_KEYS=y
|
CONFIG_BT_USE_DEBUG_KEYS=y
|
||||||
CONFIG_ZTEST=y
|
CONFIG_ZTEST=y
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_USE_DEBUG_KEYS=y
|
CONFIG_BT_USE_DEBUG_KEYS=y
|
||||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ CONFIG_BT_PERIPHERAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_USE_DEBUG_KEYS=y
|
CONFIG_BT_USE_DEBUG_KEYS=y
|
||||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_USE_DEBUG_KEYS=y
|
CONFIG_BT_USE_DEBUG_KEYS=y
|
||||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,4 @@ CONFIG_BT_PERIPHERAL=y
|
||||||
CONFIG_BT_CENTRAL=y
|
CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_ZTEST=y
|
CONFIG_ZTEST=y
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,4 @@ CONFIG_BT_PERIPHERAL=y
|
||||||
CONFIG_BT_CENTRAL=y
|
CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_ZTEST=y
|
CONFIG_ZTEST=y
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_USE_DEBUG_KEYS=y
|
CONFIG_BT_USE_DEBUG_KEYS=y
|
||||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_USE_DEBUG_KEYS=y
|
CONFIG_BT_USE_DEBUG_KEYS=y
|
||||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_USE_DEBUG_KEYS=y
|
CONFIG_BT_USE_DEBUG_KEYS=y
|
||||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,4 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_ZTEST=y
|
CONFIG_ZTEST=y
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
CONFIG_BT_CLASSIC=n
|
CONFIG_BT_CLASSIC=n
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ CONFIG_BT_ISO_PERIPHERAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_USE_DEBUG_KEYS=y
|
CONFIG_BT_USE_DEBUG_KEYS=y
|
||||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_USE_DEBUG_KEYS=y
|
CONFIG_BT_USE_DEBUG_KEYS=y
|
||||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_USE_DEBUG_KEYS=y
|
CONFIG_BT_USE_DEBUG_KEYS=y
|
||||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
CONFIG_BT_CLASSIC=n
|
CONFIG_BT_CLASSIC=n
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_SIGNING=y
|
CONFIG_BT_SIGNING=y
|
||||||
CONFIG_BT_SMP_SC_ONLY=y
|
CONFIG_BT_SMP_SC_ONLY=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
CONFIG_BT_CLASSIC=n
|
CONFIG_BT_CLASSIC=n
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,3 @@ CONFIG_RING_BUFFER=y
|
||||||
CONFIG_USB_DEVICE_STACK=y
|
CONFIG_USB_DEVICE_STACK=y
|
||||||
CONFIG_USB_DEVICE_AUDIO=y
|
CONFIG_USB_DEVICE_AUDIO=y
|
||||||
CONFIG_USB_DEVICE_PRODUCT="Zephyr Shell USB"
|
CONFIG_USB_DEVICE_PRODUCT="Zephyr Shell USB"
|
||||||
|
|
||||||
# Enable encryption in the host
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,3 @@ CONFIG_RING_BUFFER=y
|
||||||
CONFIG_USB_DEVICE_STACK=y
|
CONFIG_USB_DEVICE_STACK=y
|
||||||
CONFIG_USB_DEVICE_AUDIO=y
|
CONFIG_USB_DEVICE_AUDIO=y
|
||||||
CONFIG_USB_DEVICE_PRODUCT="Zephyr Shell USB"
|
CONFIG_USB_DEVICE_PRODUCT="Zephyr Shell USB"
|
||||||
|
|
||||||
# Enable encryption in the host
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -22,5 +22,3 @@ CONFIG_LOG_DEFAULT_LEVEL=3
|
||||||
CONFIG_BTTESTER_LOG_LEVEL_DBG=y
|
CONFIG_BTTESTER_LOG_LEVEL_DBG=y
|
||||||
|
|
||||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -22,5 +22,3 @@ CONFIG_LOG_DEFAULT_LEVEL=3
|
||||||
CONFIG_BTTESTER_LOG_LEVEL_DBG=y
|
CONFIG_BTTESTER_LOG_LEVEL_DBG=y
|
||||||
|
|
||||||
CONFIG_UART_INTERRUPT_DRIVEN=y
|
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_EVT_RX_SIZE=255
|
CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_BT_AUDIO=y
|
CONFIG_BT_AUDIO=y
|
||||||
CONFIG_BT_BAP_UNICAST_SERVER=y
|
CONFIG_BT_BAP_UNICAST_SERVER=y
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,3 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
CONFIG_BT_BUF_CMD_TX_SIZE=255
|
||||||
|
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ CONFIG_BT_BROADCASTER=y
|
||||||
CONFIG_BT_CENTRAL=y
|
CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_OBSERVER=y
|
CONFIG_BT_OBSERVER=y
|
||||||
CONFIG_LOG=y
|
CONFIG_LOG=y
|
||||||
CONFIG_BT_ECC=y
|
|
||||||
|
|
||||||
# BUF_CMD_TX_SIZE must be 255 because of HCI/GEV/BV-01-C
|
# BUF_CMD_TX_SIZE must be 255 because of HCI/GEV/BV-01-C
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=60
|
CONFIG_BT_BUF_ACL_RX_SIZE=60
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ CONFIG_BT_HCI_RAW=y
|
||||||
CONFIG_BT_PERIPHERAL=y
|
CONFIG_BT_PERIPHERAL=y
|
||||||
CONFIG_BT_CENTRAL=y
|
CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_LOG=y
|
CONFIG_LOG=y
|
||||||
CONFIG_BT_ECC=y
|
|
||||||
|
|
||||||
# BUF_CMD_TX_SIZE must be 255 because of HCI/GEV/BV-01-C
|
# BUF_CMD_TX_SIZE must be 255 because of HCI/GEV/BV-01-C
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=60
|
CONFIG_BT_BUF_ACL_RX_SIZE=60
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ CONFIG_BT_CENTRAL=y
|
||||||
CONFIG_BT_PERIPHERAL=y
|
CONFIG_BT_PERIPHERAL=y
|
||||||
CONFIG_BT_SMP=y
|
CONFIG_BT_SMP=y
|
||||||
CONFIG_BT_GATT_CLIENT=y
|
CONFIG_BT_GATT_CLIENT=y
|
||||||
CONFIG_BT_SEND_ECC_EMULATION=y
|
|
||||||
|
|
||||||
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
CONFIG_BT_BUF_ACL_RX_SIZE=255
|
||||||
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
CONFIG_BT_BUF_ACL_TX_SIZE=251
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue