Skip to content

Commit 059e86f

Browse files
alxelaxkartben
authored andcommitted
tests: Bluetooth: Mesh: restore tinycrypt mesh bsim
Commit restores ble mesh bsim tests with tinycrypt. Signed-off-by: Aleksandr Khromykh <[email protected]>
1 parent 99c3988 commit 059e86f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+95
-82
lines changed

tests/bsim/bluetooth/mesh/compile.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ app=tests/bsim/bluetooth/mesh conf_overlay=overlay_low_lat.conf compile
1818
app=tests/bsim/bluetooth/mesh conf_overlay=overlay_psa.conf compile
1919
app=tests/bsim/bluetooth/mesh conf_overlay=overlay_workq_sys.conf compile
2020
app=tests/bsim/bluetooth/mesh conf_overlay=overlay_multi_adv_sets.conf compile
21-
app=tests/bsim/bluetooth/mesh conf_overlay="overlay_pst.conf;overlay_psa.conf" compile
21+
app=tests/bsim/bluetooth/mesh \
22+
conf_overlay="overlay_pst.conf;overlay_ss.conf;overlay_psa.conf" compile
2223
app=tests/bsim/bluetooth/mesh conf_overlay="overlay_gatt.conf;overlay_psa.conf" compile
2324
app=tests/bsim/bluetooth/mesh conf_overlay="overlay_gatt.conf;overlay_workq_sys.conf" compile
2425
app=tests/bsim/bluetooth/mesh conf_overlay="overlay_low_lat.conf;overlay_psa.conf" compile
@@ -27,7 +28,7 @@ app=tests/bsim/bluetooth/mesh conf_overlay="overlay_pst.conf;overlay_gatt.conf"
2728
app=tests/bsim/bluetooth/mesh \
2829
conf_overlay="overlay_gatt.conf;overlay_multi_adv_sets.conf" compile
2930
app=tests/bsim/bluetooth/mesh \
30-
conf_overlay="overlay_pst.conf;overlay_gatt.conf;overlay_psa.conf" compile
31+
conf_overlay="overlay_pst.conf;overlay_ss.conf;overlay_gatt.conf;overlay_psa.conf" compile
3132
app=tests/bsim/bluetooth/mesh \
3233
conf_overlay="overlay_pst.conf;overlay_gatt.conf;overlay_workq_sys.conf" compile
3334
wait_for_background_jobs
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Increase the number of key slots in PSA Crypto core
22
CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT=64
33

4-
# Increase the number of key slots in PSA Crypto core
5-
CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT=64
6-
74
# Enable mbedTLS PSA as a crypto backend
85
CONFIG_BT_MESH_USES_MBEDTLS_PSA=y

tests/bsim/bluetooth/mesh/overlay_pst.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ CONFIG_BT_SETTINGS=y
33
CONFIG_FLASH=y
44
CONFIG_FLASH_MAP=y
55
CONFIG_NVS=y
6-
CONFIG_SECURE_STORAGE=y
76

87
CONFIG_BT_PERIPHERAL=y
98
CONFIG_BT_MESH_GATT_PROXY=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_SECURE_STORAGE=y

tests/bsim/bluetooth/mesh/prj.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,5 @@ CONFIG_BT_TESTING=y
7474
# Needed for RPR tests due to huge amount of retransmitted messages
7575
CONFIG_BT_MESH_MSG_CACHE_SIZE=64
7676

77-
CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT=64
77+
# Enable tinycrypt as a crypto backend
78+
CONFIG_BT_MESH_USES_TINYCRYPT=y

tests/bsim/bluetooth/mesh/src/test_brg.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,22 +246,26 @@ static void bridge_entry_remove(uint16_t src, uint16_t dst, uint16_t net_idx1, u
246246
static void tester_bridge_configure(void)
247247
{
248248
uint8_t status;
249-
int err;
250249

251250
LOG_INF("Configuring bridge...");
252251

252+
ASSERT_OK(
253+
bt_mesh_cfg_cli_net_transmit_set(0, BRIDGE_ADDR, BT_MESH_TRANSMIT(2, 20), &status));
254+
if (status != BT_MESH_TRANSMIT(2, 20)) {
255+
FAIL("Net transmit set failed (status %u)", status);
256+
}
257+
253258
for (int i = 0; i < remote_nodes; i++) {
254-
err = bt_mesh_cfg_cli_net_key_add(0, BRIDGE_ADDR, i + 1, subnet_keys[i], &status);
255-
if (err || status) {
256-
FAIL("NetKey add failed (err %d, status %u)", err, status);
257-
return;
259+
ASSERT_OK(bt_mesh_cfg_cli_net_key_add(0, BRIDGE_ADDR, i + 1, subnet_keys[i],
260+
&status));
261+
if (status) {
262+
FAIL("NetKey add failed (status %u)", status);
258263
}
259264
}
260265

261266
ASSERT_OK(bt_mesh_brg_cfg_cli_set(0, BRIDGE_ADDR, BT_MESH_BRG_CFG_ENABLED, &status));
262267
if (status != BT_MESH_BRG_CFG_ENABLED) {
263268
FAIL("Subnet bridge set failed (status %u)", status);
264-
return;
265269
}
266270

267271
/* Disable Relay feature to avoid interference in the test. */
@@ -271,7 +275,6 @@ static void tester_bridge_configure(void)
271275
BT_MESH_TRANSMIT(2, 20), &status, &transmit));
272276
if (status) {
273277
FAIL("Relay set failed (status %u)", status);
274-
return;
275278
}
276279

277280
LOG_INF("Bridge configured");

tests/bsim/bluetooth/mesh/src/test_provision.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
#if defined CONFIG_BT_MESH_USES_MBEDTLS_PSA
1717
#include <psa/crypto.h>
18+
#elif defined CONFIG_BT_MESH_USES_TINYCRYPT
19+
#include <tinycrypt/constants.h>
20+
#include <tinycrypt/ecc.h>
21+
#include <tinycrypt/ecc_dh.h>
1822
#else
1923
#error "Unknown crypto library has been chosen"
2024
#endif
@@ -462,6 +466,7 @@ static void oob_auth_set(int test_step)
462466
prov.input_actions = oob_auth_test_vector[test_step].input_actions;
463467
}
464468

469+
#if defined CONFIG_BT_MESH_USES_MBEDTLS_PSA
465470
static void generate_oob_key_pair(void)
466471
{
467472
psa_key_attributes_t key_attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -496,6 +501,12 @@ static void generate_oob_key_pair(void)
496501

497502
memcpy(public_key_be, public_key_repr + 1, 64);
498503
}
504+
#elif defined CONFIG_BT_MESH_USES_TINYCRYPT
505+
static void generate_oob_key_pair(void)
506+
{
507+
ASSERT_TRUE(uECC_make_key(public_key_be, private_key_be, uECC_secp256r1()));
508+
}
509+
#endif
499510

500511
static void oob_device(bool use_oob_pk)
501512
{

tests/bsim/bluetooth/mesh/tests_scripts/blob_mdls/blob_srv_persistence.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,27 @@ RunTestFlash blob_recover_phase \
3636
blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4
3737

3838
# The same test but with PSA crypto
39-
overlay="overlay_pst_conf_overlay_psa_conf"
39+
overlay="overlay_pst_conf_overlay_ss_conf_overlay_psa_conf"
4040
RunTestFlash blob_recover_phase_psa \
4141
blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=1
4242

43-
overlay="overlay_pst_conf_overlay_psa_conf"
43+
overlay="overlay_pst_conf_overlay_ss_conf_overlay_psa_conf"
4444
RunTestFlash blob_recover_phase_psa \
4545
blob_cli_stop blob_srv_stop -- -argstest expected-phase=2
4646

47-
overlay="overlay_pst_conf_overlay_psa_conf"
47+
overlay="overlay_pst_conf_overlay_ss_conf_overlay_psa_conf"
4848
RunTestFlash blob_recover_phase_psa \
4949
blob_cli_stop blob_srv_stop -- -argstest expected-phase=3
5050

51-
overlay="overlay_pst_conf_overlay_psa_conf"
51+
overlay="overlay_pst_conf_overlay_ss_conf_overlay_psa_conf"
5252
RunTestFlash blob_recover_phase_psa \
5353
blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4
5454

5555
# Test reaching suspended state and continuation after reboot on new procedure.
56-
overlay="overlay_pst_conf_overlay_psa_conf"
56+
overlay="overlay_pst_conf_overlay_ss_conf_overlay_psa_conf"
5757
RunTestFlash blob_recover_phase_psa \
5858
blob_cli_stop -flash_erase blob_srv_stop -flash_erase -- -argstest expected-phase=5
5959

60-
overlay="overlay_pst_conf_overlay_psa_conf"
60+
overlay="overlay_pst_conf_overlay_ss_conf_overlay_psa_conf"
6161
RunTestFlash blob_recover_phase_psa \
6262
blob_cli_stop -flash_rm blob_srv_stop -flash_rm -- -argstest expected-phase=4

tests/bsim/bluetooth/mesh/tests_scripts/bridge/brg_persistent_storage.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ RunTestFlash mesh_brg_persistence \
2121
brg_tester_persistence brg_bridge_simple
2222

2323
# The same test but with PSA crypto
24-
overlay="overlay_pst_conf_overlay_psa_conf"
24+
overlay="overlay_pst_conf_overlay_ss_conf_overlay_psa_conf"
2525
RunTestFlash mesh_brg_persistence_psa \
2626
brg_tester_persistence -flash_erase brg_bridge_simple -flash_erase
2727

28-
overlay="overlay_pst_conf_overlay_psa_conf"
28+
overlay="overlay_pst_conf_overlay_ss_conf_overlay_psa_conf"
2929
RunTestFlash mesh_brg_persistence_psa \
3030
brg_tester_persistence brg_bridge_simple

tests/bsim/bluetooth/mesh/tests_scripts/dfu/dfu_cli_all_targets_lost_on_apply.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RunTest dfu_all_tgts_lost_on_apply \
1616
dfu_target_fail_on_apply \
1717
-- -argstest targets=3
1818

19-
overlay="overlay_pst_conf_overlay_psa_conf"
19+
overlay="overlay_pst_conf_overlay_ss_conf_overlay_psa_conf"
2020
RunTest dfu_all_tgts_lost_on_apply_psa \
2121
dfu_cli_all_targets_lost_on_apply \
2222
dfu_target_fail_on_apply \

0 commit comments

Comments
 (0)