Lines Matching +full:phase +full:- +full:shift

4  * SPDX-License-Identifier: Apache-2.0
109 .option = "rand-int", in test_args_parse()
157 /* shift beaconing time line to avoid boundary cases. */ in tx_on_iv_update_test()
203 /* shift beaconing time line to avoid boundary cases. */ 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()
241 /* shift beaconing time line to avoid boundary cases. */ 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()
295 /* shift beaconing time line to avoid boundary cases. */ 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()
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()
776 * The beacon shall be processed, but shall not change Key Refresh phase. 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()
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()
1100 err = bt_mesh_provision(net_key, 0, 0, 0, dev_cfg->addr, dev_cfg->dev_key); in provision()
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()
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()
1539 #define UNTIL_UPTIME(time) (k_uptime_get() > (time) ? K_NO_WAIT : K_MSEC((time) - k_uptime_get()))
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()
1970 /* Re-enable GATT proxy and remove second and third network */ in test_tx_proxy_adv_multi_subnet_coex()
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()