Skip to content

Commit

Permalink
bt: mesh: remove TinyCrypt support
Browse files Browse the repository at this point in the history
As part of the deprecation process of TinyCrypt in Zephyr codebase
(#79566) this commit removes TinyCrypt support from BT mesh.

Signed-off-by: Valerio Setti <[email protected]>
  • Loading branch information
valeriosetti committed Oct 17, 2024
1 parent abe360a commit 9f3f671
Show file tree
Hide file tree
Showing 64 changed files with 58 additions and 373 deletions.
8 changes: 0 additions & 8 deletions include/zephyr/bluetooth/mesh/keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ struct bt_mesh_key {
psa_key_id_t key;
};

#elif defined CONFIG_BT_MESH_USES_TINYCRYPT

/** The structure that keeps representation of key. */
struct bt_mesh_key {
/** tinycrypt key representation is the pure key value. */
uint8_t key[16];
};

#else
#error "Crypto library has not been chosen"
#endif
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/bap_broadcast_assistant/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y

CONFIG_BT_EXT_ADV=y
CONFIG_BT_BAP_BASS_MAX_SUBGROUPS=2
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/bap_broadcast_sink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ CONFIG_BT_BUF_ACL_TX_SIZE=251

CONFIG_BT_DEVICE_NAME="Broadcast Audio Sink"

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y

CONFIG_LIBLC3=y
CONFIG_FPU=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y

CONFIG_LIBLC3=y
CONFIG_FPU=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255

CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
2 changes: 1 addition & 1 deletion samples/bluetooth/hap_ha/boards/native_sim.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y

# 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.
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/hci_spi/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CONFIG_MAIN_STACK_SIZE=512
CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_BT_MAX_CONN=16
CONFIG_BT_TINYCRYPT_ECC=n
CONFIG_BT_HCI_ECC=n

# Workaround: Unable to allocate command buffer when using K_NO_WAIT since
# Host number of completed commands does not follow normal flow control.
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/hci_uart/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CONFIG_BT_BUF_CMD_TX_SIZE=255
CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=255
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_MAX_CONN=16
CONFIG_BT_TINYCRYPT_ECC=n
CONFIG_BT_HCI_ECC=n
CONFIG_BT_CTLR_DTM_HCI=y

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/hci_uart_3wire/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_CMD_TX_SIZE=255
CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=255
CONFIG_BT_MAX_CONN=16
CONFIG_BT_TINYCRYPT_ECC=n
CONFIG_BT_HCI_ECC=n
CONFIG_BT_CTLR_DTM_HCI=y

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512
Expand Down
1 change: 0 additions & 1 deletion samples/bluetooth/peripheral_esp/prj.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_SMP=y
CONFIG_TINYCRYPT=y
CONFIG_BT_DEVICE_NAME="ESP peripheral"
CONFIG_BT_DIS=y
CONFIG_BT_DIS_PNP=n
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022 Telink Semiconductor
# SPDX-License-Identifier: Apache-2.0

CONFIG_BT_TINYCRYPT_ECC=n
CONFIG_BT_HCI_ECC=n
2 changes: 1 addition & 1 deletion samples/bluetooth/peripheral_sc_only/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ CONFIG_LOG=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_SMP=y
CONFIG_BT_SMP_SC_ONLY=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
CONFIG_BT_MAX_PAIRED=2
CONFIG_BT_DEVICE_NAME="SC only peripheral"
2 changes: 1 addition & 1 deletion samples/bluetooth/tmap_bmr/boards/native_posix.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y

CONFIG_LIBLC3=y
CONFIG_FPU=y
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/tmap_bmr/boards/native_sim.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y

CONFIG_LIBLC3=y
CONFIG_FPU=y
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/tmap_bms/boards/native_posix.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y

CONFIG_LIBLC3=y
CONFIG_FPU=y
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/tmap_bms/boards/native_sim.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y

CONFIG_LIBLC3=y
CONFIG_FPU=y
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/tmap_central/boards/native_posix.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y

CONFIG_LIBLC3=y
CONFIG_FPU=y
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/tmap_central/boards/native_sim.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y

CONFIG_LIBLC3=y
CONFIG_FPU=y
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/tmap_peripheral/boards/native_posix.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y

CONFIG_LIBLC3=y
CONFIG_FPU=y
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/tmap_peripheral/boards/native_sim.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y

CONFIG_LIBLC3=y
CONFIG_FPU=y
Expand Down
2 changes: 1 addition & 1 deletion samples/boards/nordic/mesh/onoff-app/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CONFIG_BT_CTLR_PRIVACY=n
CONFIG_BT_PERIPHERAL=y

CONFIG_BT=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
CONFIG_BT_L2CAP_TX_BUF_COUNT=8

CONFIG_BT_MESH=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

CONFIG_BT_PERIPHERAL=y
CONFIG_BT=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HCI_ECC=y
CONFIG_BT_RX_STACK_SIZE=4096
CONFIG_BT_L2CAP_TX_BUF_COUNT=8

Expand Down
3 changes: 1 addition & 2 deletions subsys/bluetooth/common/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ config BT_WAIT_NOP

config BT_RPA
bool
select TINYCRYPT
select TINYCRYPT_AES
depends on BT_HOST_CRYPTO || BT_CTLR_CRYPTO

config BT_ASSERT
bool "Custom Bluetooth assert implementation"
Expand Down
6 changes: 1 addition & 5 deletions subsys/bluetooth/mesh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,7 @@ zephyr_library_sources_ifdef(CONFIG_BT_MESH_STATISTIC statistic.c)

zephyr_library_sources_ifdef(CONFIG_BT_MESH_ACCESS_DELAYABLE_MSG delayable_msg.c)

if (CONFIG_BT_MESH_USES_TINYCRYPT)
zephyr_library_sources(crypto_tc.c)
else()
zephyr_library_sources(crypto_psa.c)
endif()
zephyr_library_sources(crypto_psa.c)

zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS)

Expand Down
17 changes: 2 additions & 15 deletions subsys/bluetooth/mesh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1399,30 +1399,17 @@ endmenu # Proxy
choice BT_MESH_CRYPTO_LIB
prompt "Crypto library:"
default BT_MESH_USES_TFM_PSA if BUILD_WITH_TFM
default BT_MESH_USES_TINYCRYPT
default BT_MESH_USES_MBEDTLS_PSA
help
Crypto library selection for mesh security.

config BT_MESH_USES_TINYCRYPT
bool "TinyCrypt"
select TINYCRYPT
select TINYCRYPT_AES
select TINYCRYPT_AES_CMAC
select TINYCRYPT_ECC_DH
select TINYCRYPT_SHA256
select TINYCRYPT_SHA256_HMAC
select BT_HOST_CCM
help
Use TinyCrypt library to perform crypto operations.

config BT_MESH_USES_MBEDTLS_PSA
bool "mbed TLS PSA [EXPERIMENTAL]"
select EXPERIMENTAL
select MBEDTLS
select MBEDTLS_PSA_CRYPTO_C
select MBEDTLS_ENTROPY_C
select MBEDTLS_ENTROPY_POLL_ZEPHYR
select MBEDTLS_PSA_CRYPTO_C
select MBEDTLS_USE_PSA_CRYPTO
select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT
select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT
select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE
Expand Down
Loading

0 comments on commit 9f3f671

Please sign in to comment.