Skip to content

Commit b749247

Browse files
alxelaxPavelVPV
authored andcommitted
[nrf fromtree] Bluetooth: Mesh: remove device key candidate
Commit removes device key candidate if provisionee failed during device key refresh procedure or mesh reset has been called in between. Otherwise, device key candidate gets stuck in the internal trusted storage of crypto library. Signed-off-by: Aleksandr Khromykh <[email protected]> (cherry picked from commit bf22fa6) Signed-off-by: Pavel Vasilyev <[email protected]>
1 parent 0fa4d69 commit b749247

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

subsys/bluetooth/mesh/main.c

+6
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ void bt_mesh_dev_key_cand_remove(void)
237237
}
238238

239239
LOG_DBG("");
240+
bt_mesh_key_destroy(&bt_mesh.dev_key_cand);
241+
memset(&bt_mesh.dev_key_cand, 0, sizeof(struct bt_mesh_key));
240242

241243
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
242244
bt_mesh_net_dev_key_cand_store();
@@ -398,6 +400,10 @@ void bt_mesh_reset(void)
398400
bt_mesh_key_destroy(&bt_mesh.dev_key);
399401
memset(&bt_mesh.dev_key, 0, sizeof(bt_mesh.dev_key));
400402

403+
if (IS_ENABLED(CONFIG_BT_MESH_RPR_SRV)) {
404+
bt_mesh_dev_key_cand_remove();
405+
}
406+
401407
bt_mesh_beacon_disable();
402408

403409
bt_mesh_comp_unprovision();

0 commit comments

Comments
 (0)