Lines Matching refs:bt_mesh_prov_link
47 bt_mesh_prov_link.expect = PROV_NO_PDU; in prov_send_fail_msg()
66 atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION)) { in prov_fail()
81 memcpy(bt_mesh_prov_link.conf_inputs.invite, data, PDU_LEN_INVITE); in prov_invite()
129 memcpy(bt_mesh_prov_link.conf_inputs.capabilities, &buf.data[1], PDU_LEN_CAPABILITIES); in prov_invite()
136 bt_mesh_prov_link.expect = PROV_START; in prov_invite()
149 bt_mesh_prov_link.algorithm = data[0]; in prov_start()
152 bt_mesh_prov_link.algorithm = data[0]; in prov_start()
169 atomic_set_bit_to(bt_mesh_prov_link.flags, OOB_PUB_KEY, data[1] == PUB_KEY_OOB); in prov_start()
171 memcpy(bt_mesh_prov_link.conf_inputs.start, data, PDU_LEN_START); in prov_start()
173 bt_mesh_prov_link.expect = PROV_PUB_KEY; in prov_start()
174 bt_mesh_prov_link.oob_method = data[2]; in prov_start()
175 bt_mesh_prov_link.oob_action = data[3]; in prov_start()
176 bt_mesh_prov_link.oob_size = data[4]; in prov_start()
179 (bt_mesh_prov_link.oob_method == AUTH_METHOD_NO_OOB || in prov_start()
180 bt_mesh_prov_link.algorithm == BT_MESH_PROV_AUTH_CMAC_AES128_AES_CCM)) { in prov_start()
192 if (atomic_test_bit(bt_mesh_prov_link.flags, OOB_STATIC_KEY)) { in prov_start()
194 memcpy(bt_mesh_prov_link.auth, bt_mesh_prov->static_val, in prov_start()
200 memset(bt_mesh_prov_link.auth + bt_mesh_prov->static_val_len, 0, in prov_start()
210 uint8_t *inputs = (uint8_t *)&bt_mesh_prov_link.conf_inputs; in send_confirm()
219 if (bt_mesh_prov_conf_salt(bt_mesh_prov_link.algorithm, inputs, in send_confirm()
220 bt_mesh_prov_link.conf_salt)) { in send_confirm()
226 LOG_DBG("ConfirmationSalt: %s", bt_hex(bt_mesh_prov_link.conf_salt, auth_size)); in send_confirm()
228 memcpy(conf_key_input, bt_mesh_prov_link.dhkey, 32); in send_confirm()
231 bt_mesh_prov_link.algorithm == BT_MESH_PROV_AUTH_HMAC_SHA256_AES_CCM) { in send_confirm()
232 memcpy(&conf_key_input[32], bt_mesh_prov_link.auth, 32); in send_confirm()
233 LOG_DBG("AuthValue %s", bt_hex(bt_mesh_prov_link.auth, 32)); in send_confirm()
236 if (bt_mesh_prov_conf_key(bt_mesh_prov_link.algorithm, conf_key_input, in send_confirm()
237 bt_mesh_prov_link.conf_salt, bt_mesh_prov_link.conf_key)) { in send_confirm()
243 LOG_DBG("ConfirmationKey: %s", bt_hex(bt_mesh_prov_link.conf_key, auth_size)); in send_confirm()
245 if (bt_rand(bt_mesh_prov_link.rand, auth_size)) { in send_confirm()
251 LOG_DBG("LocalRandom: %s", bt_hex(bt_mesh_prov_link.rand, auth_size)); in send_confirm()
255 if (bt_mesh_prov_conf(bt_mesh_prov_link.algorithm, bt_mesh_prov_link.conf_key, in send_confirm()
256 bt_mesh_prov_link.rand, bt_mesh_prov_link.auth, in send_confirm()
268 bt_mesh_prov_link.expect = PROV_RANDOM; in send_confirm()
280 bt_mesh_prov_link.expect = PROV_CONFIRM; in send_input_complete()
285 atomic_set_bit(bt_mesh_prov_link.flags, PUB_KEY_SENT); in public_key_sent()
287 if (atomic_test_bit(bt_mesh_prov_link.flags, INPUT_COMPLETE)) { in public_key_sent()
295 if (atomic_test_bit(bt_mesh_prov_link.flags, WAIT_NUMBER) || in start_auth()
296 atomic_test_bit(bt_mesh_prov_link.flags, WAIT_STRING)) { in start_auth()
297 bt_mesh_prov_link.expect = PROV_NO_PDU; /* Wait for input */ in start_auth()
299 bt_mesh_prov_link.expect = PROV_CONFIRM; in start_auth()
320 memcpy(bt_mesh_prov_link.conf_inputs.pub_key_device, &buf.data[1], PDU_LEN_PUB_KEY); in send_pub_key()
335 remote_pub_key = bt_mesh_prov_link.conf_inputs.pub_key_provisioner; in prov_dh_key_gen()
338 atomic_test_bit(bt_mesh_prov_link.flags, OOB_PUB_KEY)) { in prov_dh_key_gen()
344 if (bt_mesh_dhkey_gen(remote_pub_key, remote_priv_key, bt_mesh_prov_link.dhkey)) { in prov_dh_key_gen()
350 LOG_DBG("DHkey: %s", bt_hex(bt_mesh_prov_link.dhkey, DH_KEY_SIZE)); in prov_dh_key_gen()
352 if (atomic_test_bit(bt_mesh_prov_link.flags, OOB_PUB_KEY)) { in prov_dh_key_gen()
371 memcpy(bt_mesh_prov_link.conf_inputs.pub_key_provisioner, data, PDU_LEN_PUB_KEY); in prov_pub_key()
374 atomic_test_bit(bt_mesh_prov_link.flags, OOB_PUB_KEY)) { in prov_pub_key()
382 bt_mesh_prov_link.conf_inputs.pub_key_provisioner, PDU_LEN_PUB_KEY)) { in prov_pub_key()
389 memcpy(bt_mesh_prov_link.conf_inputs.pub_key_device, bt_mesh_prov->public_key_be, in prov_pub_key()
398 if (atomic_test_and_clear_bit(bt_mesh_prov_link.flags, in notify_input_complete()
410 net_buf_simple_add_mem(&rnd, bt_mesh_prov_link.rand, bt_mesh_prov_auth_size_get()); in send_random()
417 bt_mesh_prov_link.expect = PROV_DATA; in send_random()
426 if (!memcmp(data, bt_mesh_prov_link.rand, rand_size)) { in prov_random()
432 if (bt_mesh_prov_conf(bt_mesh_prov_link.algorithm, bt_mesh_prov_link.conf_key, in prov_random()
433 data, bt_mesh_prov_link.auth, conf_verify)) { in prov_random()
439 if (memcmp(conf_verify, bt_mesh_prov_link.conf, rand_size)) { in prov_random()
441 LOG_DBG("Received: %s", bt_hex(bt_mesh_prov_link.conf, rand_size)); in prov_random()
447 if (bt_mesh_prov_salt(bt_mesh_prov_link.algorithm, bt_mesh_prov_link.conf_salt, in prov_random()
448 data, bt_mesh_prov_link.rand, bt_mesh_prov_link.prov_salt)) { in prov_random()
454 LOG_DBG("ProvisioningSalt: %s", bt_hex(bt_mesh_prov_link.prov_salt, 16)); in prov_random()
465 memcpy(bt_mesh_prov_link.conf, data, conf_size); in prov_confirm()
473 return bt_mesh_prov_link.bearer && in is_pb_gatt()
474 bt_mesh_prov_link.bearer->type == BT_MESH_PROV_GATT; in is_pb_gatt()
496 valid_addr = bt_mesh_prov_link.addr < old_addr || in refresh_is_valid()
497 bt_mesh_prov_link.addr >= old_addr + bt_mesh_comp_get()->elem_count; in refresh_is_valid()
499 valid_addr = bt_mesh_prov_link.addr == bt_mesh_primary_addr(); in refresh_is_valid()
524 err = bt_mesh_session_key(bt_mesh_prov_link.dhkey, in prov_data()
525 bt_mesh_prov_link.prov_salt, &session_key); in prov_data()
532 err = bt_mesh_prov_nonce(bt_mesh_prov_link.dhkey, in prov_data()
533 bt_mesh_prov_link.prov_salt, nonce); in prov_data()
549 err = bt_mesh_dev_key(bt_mesh_prov_link.dhkey, in prov_data()
550 bt_mesh_prov_link.prov_salt, dev_key); in prov_data()
560 bt_mesh_prov_link.addr = sys_get_be16(&pdu[23]); in prov_data()
563 atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION) && in prov_data()
570 net_idx, iv_index, bt_mesh_prov_link.addr); in prov_data()
579 bt_mesh_prov_link.expect = PROV_NO_PDU; in prov_data()
580 atomic_set_bit(bt_mesh_prov_link.flags, COMPLETE); in prov_data()
583 atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION)) { in prov_data()
595 err = bt_mesh_provision(pdu, net_idx, flags, iv_index, bt_mesh_prov_link.addr, dev_key); in prov_data()
614 bt_mesh_reprovision(bt_mesh_prov_link.addr); in reprovision_complete()
636 if (atomic_test_bit(bt_mesh_prov_link.flags, PUB_KEY_SENT) || in local_input_complete()
637 atomic_test_bit(bt_mesh_prov_link.flags, OOB_PUB_KEY)) { in local_input_complete()
640 atomic_set_bit(bt_mesh_prov_link.flags, INPUT_COMPLETE); in local_input_complete()
647 atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION)) { in prov_link_closed()
648 if (atomic_test_bit(bt_mesh_prov_link.flags, COMPLETE) && in prov_link_closed()
654 } else if (bt_mesh_prov_link.conf_inputs.invite[0]) { in prov_link_closed()
664 bt_mesh_prov_link.expect = PROV_INVITE; in prov_link_opened()
666 atomic_set_bit(bt_mesh_prov_link.flags, REPROVISION); in prov_link_opened()
719 bt_mesh_prov_link.role = &role_device; in bt_mesh_prov_enable()