Skip to content

Commit 5f74390

Browse files
committed
feat(ble_mesh): unify tinycrypto component
1 parent e0c43e6 commit 5f74390

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

components/bt/CMakeLists.txt

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ set(common_include_dirs
2929

3030
set(ble_mesh_include_dirs
3131
"esp_ble_mesh/common/include"
32-
"esp_ble_mesh/common/tinycrypt/include"
3332
"esp_ble_mesh/core"
3433
"esp_ble_mesh/core/include"
3534
"esp_ble_mesh/core/storage"
@@ -42,6 +41,10 @@ set(ble_mesh_include_dirs
4241
"esp_ble_mesh/api"
4342
)
4443

44+
set(ble_mesh_tinycrypt_dirs
45+
"esp_ble_mesh/common/tinycrypt/include"
46+
)
47+
4548
set(ble_mesh_v11_include_dirs
4649
"esp_ble_mesh/lib/include"
4750
"esp_ble_mesh/v1.1/api/core/include"
@@ -500,21 +503,6 @@ if(CONFIG_BT_ENABLED)
500503
"esp_ble_mesh/btc/btc_ble_mesh_prov.c"
501504
"esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c"
502505
"esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c"
503-
"esp_ble_mesh/common/tinycrypt/src/aes_decrypt.c"
504-
"esp_ble_mesh/common/tinycrypt/src/aes_encrypt.c"
505-
"esp_ble_mesh/common/tinycrypt/src/cbc_mode.c"
506-
"esp_ble_mesh/common/tinycrypt/src/ccm_mode.c"
507-
"esp_ble_mesh/common/tinycrypt/src/cmac_mode.c"
508-
"esp_ble_mesh/common/tinycrypt/src/ctr_mode.c"
509-
"esp_ble_mesh/common/tinycrypt/src/ctr_prng.c"
510-
"esp_ble_mesh/common/tinycrypt/src/ecc_dh.c"
511-
"esp_ble_mesh/common/tinycrypt/src/ecc_dsa.c"
512-
"esp_ble_mesh/common/tinycrypt/src/ecc_platform_specific.c"
513-
"esp_ble_mesh/common/tinycrypt/src/ecc.c"
514-
"esp_ble_mesh/common/tinycrypt/src/hmac_prng.c"
515-
"esp_ble_mesh/common/tinycrypt/src/hmac.c"
516-
"esp_ble_mesh/common/tinycrypt/src/sha256.c"
517-
"esp_ble_mesh/common/tinycrypt/src/utils.c"
518506
"esp_ble_mesh/common/atomic.c"
519507
"esp_ble_mesh/common/buf.c"
520508
"esp_ble_mesh/common/common.c"
@@ -565,6 +553,26 @@ if(CONFIG_BT_ENABLED)
565553
"esp_ble_mesh/models/server/state_binding.c"
566554
"esp_ble_mesh/models/server/state_transition.c"
567555
"esp_ble_mesh/models/server/time_scene_server.c")
556+
557+
if(NOT CONFIG_BLE_MESH_USE_UNIFIED_CRYPTO)
558+
list(APPEND include_dirs ${ble_mesh_tinycrypt_dirs})
559+
list(APPEND srcs
560+
"esp_ble_mesh/common/tinycrypt/src/aes_decrypt.c"
561+
"esp_ble_mesh/common/tinycrypt/src/aes_encrypt.c"
562+
"esp_ble_mesh/common/tinycrypt/src/cbc_mode.c"
563+
"esp_ble_mesh/common/tinycrypt/src/ccm_mode.c"
564+
"esp_ble_mesh/common/tinycrypt/src/cmac_mode.c"
565+
"esp_ble_mesh/common/tinycrypt/src/ctr_mode.c"
566+
"esp_ble_mesh/common/tinycrypt/src/ctr_prng.c"
567+
"esp_ble_mesh/common/tinycrypt/src/ecc_dh.c"
568+
"esp_ble_mesh/common/tinycrypt/src/ecc_dsa.c"
569+
"esp_ble_mesh/common/tinycrypt/src/ecc_platform_specific.c"
570+
"esp_ble_mesh/common/tinycrypt/src/ecc.c"
571+
"esp_ble_mesh/common/tinycrypt/src/hmac_prng.c"
572+
"esp_ble_mesh/common/tinycrypt/src/hmac.c"
573+
"esp_ble_mesh/common/tinycrypt/src/sha256.c"
574+
"esp_ble_mesh/common/tinycrypt/src/utils.c")
575+
endif()
568576
if(CONFIG_BLE_MESH_V11_SUPPORT)
569577
list(APPEND include_dirs ${ble_mesh_v11_include_dirs})
570578

components/bt/esp_ble_mesh/Kconfig.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ if BLE_MESH
2222
for mesh packets. And this could help avoid collision of
2323
advertising packets.
2424

25+
config BLE_MESH_USE_UNIFIED_CRYPTO
26+
bool "Use the unified BLE tinycrypt implementation"
27+
depends on !BT_LE_CRYPTO_STACK_MBEDTLS && !BT_NIMBLE_CRYPTO_STACK_MBEDTLS
28+
default n
29+
help
30+
Enable this option to use the unified BLE tinycrypt solution
31+
instead of the default one in BLE Mesh stack.
32+
2533
menuconfig BLE_MESH_USE_BLE_50
2634
bool "Support using BLE 5.0 APIs for BLE Mesh"
2735
depends on BLE_MESH_EXPERIMENTAL

0 commit comments

Comments
 (0)