Lines Matching +full:2 +full:- +full:phase

4  * SPDX-License-Identifier: Apache-2.0
90 static uint8_t net_key[16] = { 1, 2, 3 };
109 .option = "rand-int", in test_args_parse()
177 ASSERT_TRUE(bt_mesh.iv_index == 2); in tx_on_iv_update_test()
225 ASSERT_TRUE(bt_mesh.iv_index == 2); in test_rx_on_iv_update()
234 uint8_t phase; in tx_on_key_refresh_test() local
237 status = bt_mesh_subnet_kr_phase_get(BT_MESH_KEY_PRIMARY, &phase); in tx_on_key_refresh_test()
239 ASSERT_TRUE(phase == BT_MESH_KR_NORMAL); in tx_on_key_refresh_test()
246 status = bt_mesh_subnet_kr_phase_get(BT_MESH_KEY_PRIMARY, &phase); in tx_on_key_refresh_test()
248 ASSERT_TRUE(phase == BT_MESH_KR_PHASE_1); in tx_on_key_refresh_test()
252 phase = BT_MESH_KR_PHASE_2; in tx_on_key_refresh_test()
253 status = bt_mesh_subnet_kr_phase_set(BT_MESH_KEY_PRIMARY, &phase); in tx_on_key_refresh_test()
255 status = bt_mesh_subnet_kr_phase_get(BT_MESH_KEY_PRIMARY, &phase); in tx_on_key_refresh_test()
257 ASSERT_TRUE(phase == BT_MESH_KR_PHASE_2); in tx_on_key_refresh_test()
261 phase = BT_MESH_KR_PHASE_3; in tx_on_key_refresh_test()
262 status = bt_mesh_subnet_kr_phase_set(BT_MESH_KEY_PRIMARY, &phase); in tx_on_key_refresh_test()
264 status = bt_mesh_subnet_kr_phase_get(BT_MESH_KEY_PRIMARY, &phase); in tx_on_key_refresh_test()
266 ASSERT_TRUE(phase == BT_MESH_KR_NORMAL); in tx_on_key_refresh_test()
282 uint8_t phase; in test_rx_on_key_refresh() local
291 status = bt_mesh_subnet_kr_phase_get(BT_MESH_KEY_PRIMARY, &phase); in test_rx_on_key_refresh()
293 ASSERT_TRUE(phase == BT_MESH_KR_NORMAL); in test_rx_on_key_refresh()
300 status = bt_mesh_subnet_kr_phase_get(BT_MESH_KEY_PRIMARY, &phase); in test_rx_on_key_refresh()
302 ASSERT_TRUE(phase == BT_MESH_KR_PHASE_1); in test_rx_on_key_refresh()
306 status = bt_mesh_subnet_kr_phase_get(BT_MESH_KEY_PRIMARY, &phase); in test_rx_on_key_refresh()
308 ASSERT_TRUE(phase == BT_MESH_KR_PHASE_1); in test_rx_on_key_refresh()
312 status = bt_mesh_subnet_kr_phase_get(BT_MESH_KEY_PRIMARY, &phase); in test_rx_on_key_refresh()
314 ASSERT_TRUE(phase == BT_MESH_KR_PHASE_2); in test_rx_on_key_refresh()
318 status = bt_mesh_subnet_kr_phase_get(BT_MESH_KEY_PRIMARY, &phase); in test_rx_on_key_refresh()
320 ASSERT_TRUE(phase == BT_MESH_KR_NORMAL); in test_rx_on_key_refresh()
347 ASSERT_EQUAL(buf->len, length); in beacon_scan_cb()
365 memcpy(beacon.random, buf->data, 13); in beacon_scan_cb()
368 bt_mesh_beacon_decrypt(&priv_beacon_key, &buf->data[0], &buf->data[13], in beacon_scan_cb()
369 &buf->data[20], private_beacon_data); in beacon_scan_cb()
414 ad.data = buf->data; in send_beacon()
415 ad.data_len = buf->len; in send_beacon()
475 buf->data[offsets[i]] ^= 0xFF; in corrupted_beacon_test()
477 buf->data[offsets[i]] ^= 0xFF; in corrupted_beacon_test()
506 uint8_t fields_offsets[4] = {1, 2, 10, 14}; in test_tx_invalid()
545 k_sleep(K_SECONDS((BEACON_INTERVAL + 1) * 2)); in test_rx_invalid()
579 * beacon shall not change Key Refresh phase, but should still be processed. The beacon in test_tx_kr_old_key()
598 * the new Net Key. The node shall set Key Refresh phase to 2. The beacon interval shall in test_tx_kr_old_key()
618 /* Try the same with the new Net Key. Now the node shall change Key Refresh phase to 0. The in test_tx_kr_old_key()
654 uint8_t phase; in test_rx_kr_old_key() local
662 err = bt_mesh_cfg_cli_net_key_update(0, cfg->addr, 0, test_net_key_2, &status); in test_rx_kr_old_key()
668 uint8_t phase; in test_rx_kr_old_key() member
672 /* Old Net Key, attempt to change Key Refresh phase to 2. */ in test_rx_kr_old_key()
673 { .phase = BT_MESH_KR_PHASE_1, .ivu = false, .ivi = 0 }, in test_rx_kr_old_key()
675 { .phase = BT_MESH_KR_PHASE_1, .ivu = true, .ivi = 1 }, in test_rx_kr_old_key()
676 /* New Net Key, changing Key Refresh phase. */ in test_rx_kr_old_key()
677 { .phase = BT_MESH_KR_PHASE_2, .ivu = true, .ivi = 1 }, in test_rx_kr_old_key()
679 { .phase = BT_MESH_KR_PHASE_2, .ivu = true, .ivi = 1 }, in test_rx_kr_old_key()
680 /* New Net Key, changing Key Refresh phase to 0. */ in test_rx_kr_old_key()
681 { .phase = BT_MESH_KR_NORMAL, .ivu = true, .ivi = 1 }, in test_rx_kr_old_key()
683 { .phase = BT_MESH_KR_NORMAL, .ivu = true, .ivi = 1 }, in test_rx_kr_old_key()
685 { .phase = BT_MESH_KR_NORMAL, .ivu = false, .ivi = 1 }, in test_rx_kr_old_key()
691 status = bt_mesh_subnet_kr_phase_get(0, &phase); in test_rx_kr_old_key()
693 FAIL("Unable to populate Key Refresh phase (status: %d)", status); in test_rx_kr_old_key()
696 ASSERT_EQUAL(test_vector[i].phase, phase); in test_rx_kr_old_key()
701 k_sleep(K_SECONDS((BEACON_INTERVAL + 1) * 2)); in test_rx_kr_old_key()
776 * The beacon shall be processed, but shall not change Key Refresh phase. in test_tx_multiple_netkeys()
781 beacon_confirm_by_subnet, &buf.data[2])); in test_tx_multiple_netkeys()
783 beacon_confirm_by_subnet, &buf.data[2])); in test_tx_multiple_netkeys()
793 * Refresh phase to 2. in test_tx_multiple_netkeys()
826 /* Do the same with the new Net Key. Now the node shall change Key Refresh phase in test_tx_multiple_netkeys()
863 uint8_t phase; in test_rx_multiple_netkeys() local
871 /* Add new Net Keys and switch Key Refresh phase to 1 so that beacons can trigger Key in test_rx_multiple_netkeys()
875 err = bt_mesh_cfg_cli_net_key_add(0, cfg->addr, i + 1, net_key_pairs[i].primary, in test_rx_multiple_netkeys()
881 err = bt_mesh_cfg_cli_net_key_update(0, cfg->addr, i + 1, in test_rx_multiple_netkeys()
889 /* Tx device shall change Key Refresh phase to 2. */ in test_rx_multiple_netkeys()
892 status = bt_mesh_subnet_kr_phase_get(i + 1, &phase); in test_rx_multiple_netkeys()
894 FAIL("Unable to populate Key Refresh phase (status: %d)", status); in test_rx_multiple_netkeys()
897 ASSERT_EQUAL(BT_MESH_KR_PHASE_2, phase); in test_rx_multiple_netkeys()
899 /* Tx device shall change Key Refresh phase to 0. */ in test_rx_multiple_netkeys()
902 status = bt_mesh_subnet_kr_phase_get(i + 1, &phase); in test_rx_multiple_netkeys()
904 FAIL("Unable to populate Key Refresh phase (status: %d)", status); in test_rx_multiple_netkeys()
907 ASSERT_EQUAL(BT_MESH_KR_NORMAL, phase); in test_rx_multiple_netkeys()
925 k_work_schedule(&beacon_timer, K_SECONDS(2)); in secure_beacon_send()
931 k_sleep(K_SECONDS(2)); in test_tx_secure_beacon_interval()
957 k_sleep(K_SECONDS(2)); in test_rx_secure_beacon_interval()
960 * Sending 2 SNB 20ms apart by only sending for even values of loop variable. in test_rx_secure_beacon_interval()
965 if (i % 2) { in test_rx_secure_beacon_interval()
989 * Sending beacon with 2sec interval. in test_rx_secure_beacon_interval()
1007 /* IV idx of 2 marks end of test */ in snb_recv()
1008 if (snb->iv_idx == 2) { in snb_recv()
1013 ASSERT_EQUAL(snb->flags, 0x02); in snb_recv()
1014 ASSERT_EQUAL(snb->iv_idx, 1); in snb_recv()
1047 for (size_t i = 0; i < 2; i++) { in test_tx_beacon_cache()
1100 err = bt_mesh_provision(net_key, 0, 0, 0, dev_cfg->addr, dev_cfg->dev_key); in provision()
1222 for (i = 0; i < 2; i++) { in test_rx_priv_adv()
1225 for (int j = 0; j < 2; j++) { in test_rx_priv_adv()
1330 k_sleep(K_SECONDS((BEACON_INTERVAL + 1) * 2)); in test_rx_priv_invalid()
1362 uint8_t phase; in test_tx_priv_interleave() local
1380 status = bt_mesh_subnet_kr_phase_get(0, &phase); in test_tx_priv_interleave()
1382 ASSERT_TRUE(phase == BT_MESH_KR_NORMAL); in test_tx_priv_interleave()
1405 status = bt_mesh_subnet_kr_phase_get(BT_MESH_KEY_PRIMARY, &phase); in test_tx_priv_interleave()
1407 ASSERT_TRUE(phase == BT_MESH_KR_PHASE_1); in test_tx_priv_interleave()
1409 phase = BT_MESH_KR_PHASE_2; in test_tx_priv_interleave()
1410 status = bt_mesh_subnet_kr_phase_set(BT_MESH_KEY_PRIMARY, &phase); in test_tx_priv_interleave()
1412 status = bt_mesh_subnet_kr_phase_get(BT_MESH_KEY_PRIMARY, &phase); in test_tx_priv_interleave()
1414 ASSERT_TRUE(phase == BT_MESH_KR_PHASE_2); in test_tx_priv_interleave()
1482 /* IV idx of 2 marks end of test */ in priv_beacon_recv()
1483 if (prb->iv_idx == 2) { in priv_beacon_recv()
1488 ASSERT_EQUAL(prb->flags, 0x02); in priv_beacon_recv()
1489 ASSERT_EQUAL(prb->iv_idx, 1); in priv_beacon_recv()
1523 for (size_t i = 0; i < 2; i++) { in test_tx_priv_beacon_cache()
1539 #define UNTIL_UPTIME(time) (k_uptime_get() > (time) ? K_NO_WAIT : K_MSEC((time) - k_uptime_get()))
1542 #define BEACON_TYPE_PRIVATE_NET_ID 2
1547 #define TEST_NET_IDX3 2
1564 static struct netkey_ctx pp_net2 = {.net_key = (uint8_t *)test_net_key_3, .net_idx = 2};
1573 ASSERT_OK_MSG(bt_mesh_identity_key(net->net_key, &net->id_key), in pp_netkey_ctx_init()
1575 ASSERT_OK_MSG(bt_mesh_k3(net->net_key, net->net_id), "Failed to generate Net ID"); in pp_netkey_ctx_init()
1581 uint8_t len = buf->len; in proxy_adv_type_get()
1610 memcpy(&tmp[0], net->net_id, 8); in proxy_adv_hash_calc()
1614 bt_mesh_encrypt(&net->id_key, tmp, tmp); in proxy_adv_hash_calc()
1625 proxy_adv_hash_calc(&pp_net0, beacon.pp_random, test_ctx->node_id_addr, true)); in pp_beacon_check()
1641 if (proxy_adv_type_get(adv_type, buf) != ctx->beacon_type) { in priv_scan_cb()
1648 if (ctx->beacon_type == BEACON_TYPE_NET_ID) { in priv_scan_cb()
1678 beac->evt_type = proxy_adv_type_get(adv_type, buf); in proxy_adv_scan_all_cb()
1679 if (beac->evt_type == 0xFF) { in proxy_adv_scan_all_cb()
1685 beac->rx_timestamp = k_uptime_get(); in proxy_adv_scan_all_cb()
1687 if (beac->evt_type == BEACON_TYPE_NET_ID) { in proxy_adv_scan_all_cb()
1688 beac->ctx.net_id = net_buf_simple_pull_le64(buf); in proxy_adv_scan_all_cb()
1690 beac->ctx.enc.hash = net_buf_simple_pull_le64(buf); in proxy_adv_scan_all_cb()
1691 beac->ctx.enc.random = net_buf_simple_pull_le64(buf); in proxy_adv_scan_all_cb()
1831 switch (beac->evt_type) { in proxy_adv_subnet_find()
1833 if (!memcmp(nets[i]->net_id, &beac->ctx.net_id, 8)) { in proxy_adv_subnet_find()
1834 beac->net_idx = nets[i]->net_idx; in proxy_adv_subnet_find()
1839 if (beac->ctx.enc.hash == in proxy_adv_subnet_find()
1840 proxy_adv_hash_calc(nets[i], beac->ctx.enc.random, in proxy_adv_subnet_find()
1842 beac->net_idx = nets[i]->net_idx; in proxy_adv_subnet_find()
1847 if (beac->ctx.enc.hash == in proxy_adv_subnet_find()
1848 proxy_adv_hash_calc(nets[i], beac->ctx.enc.random, in proxy_adv_subnet_find()
1850 beac->net_idx = nets[i]->net_idx; in proxy_adv_subnet_find()
1855 if (beac->ctx.enc.hash == in proxy_adv_subnet_find()
1856 proxy_adv_hash_calc(nets[i], beac->ctx.enc.random, in proxy_adv_subnet_find()
1858 beac->net_idx = nets[i]->net_idx; in proxy_adv_subnet_find()
1887 if ((exp_evts[i].evt_cnt) && (beac->evt_type == exp_evts[i].evt_type) && in proxy_adv_register_evt()
1888 (beac->net_idx == exp_evts[i].net_idx) && in proxy_adv_register_evt()
1889 (beac->rx_timestamp >= exp_evts[i].time.after) && in proxy_adv_register_evt()
1890 (beac->rx_timestamp <= exp_evts[i].time.before)) { in proxy_adv_register_evt()
1891 exp_evts[i].evt_cnt--; in proxy_adv_register_evt()
1902 LOG_ERR("Missing %d expected %s idx %d events in period %llums-%llums", in proxy_adv_confirm_evt()
1923 ASSERT_TRUE(wait_for_beacon(proxy_adv_scan_all_cb, 2, NULL, &beac)); in proxy_adv_scan_all()
1970 /* Re-enable GATT proxy and remove second and third network */ in test_tx_proxy_adv_multi_subnet_coex()
2030 {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 2, .evt_cnt = 8, in test_rx_proxy_adv_multi_subnet_coex()
2044 {.evt_type = BEACON_TYPE_NET_ID, .net_idx = 2, .evt_cnt = 16, in test_rx_proxy_adv_multi_subnet_coex()
2087 } net_ctx[2] = { in test_rx_priv_multi_net_id()
2109 ASSERT_IN_RANGE(k_uptime_get() - net_ctx[old_idx].start, in test_rx_priv_multi_net_id()
2110 MAX_TIMEOUT - 1000, MAX_TIMEOUT + 1000); in test_rx_priv_multi_net_id()
2116 itr--; in test_rx_priv_multi_net_id()
2154 k_sleep(K_SECONDS(2)); in test_tx_priv_gatt_proxy()