Skip to content

Commit b471b72

Browse files
Michał Narajowskitrond-snekvik
authored andcommitted
[nrf fromtree] Bluetooth: Mesh: Verify if Remote confirmation is not
...identical MESH/PVNR/PROV/BI-18-C verifies that the IUT rejects invalid Confirmation Value. Signed-off-by: Michał Narajowski <[email protected]> (cherry picked from commit 88b60f3) Signed-off-by: Trond Einar Snekvik <[email protected]>
1 parent f01dc5d commit b471b72

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

subsys/bluetooth/mesh/prov.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ struct bt_mesh_prov_link {
118118
uint8_t dhkey[BT_DH_KEY_LEN]; /* Calculated DHKey */
119119
uint8_t expect; /* Next expected PDU */
120120

121-
uint8_t conf[16]; /* Remote Confirmation */
121+
uint8_t conf[16]; /* Local/Remote Confirmation */
122122
uint8_t rand[16]; /* Local Random */
123123

124124
uint8_t conf_salt[16]; /* ConfirmationSalt */

subsys/bluetooth/mesh/provisioner.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,14 @@ static void send_confirm(void)
297297

298298
if (bt_mesh_prov_conf(bt_mesh_prov_link.conf_key,
299299
bt_mesh_prov_link.rand, bt_mesh_prov_link.auth,
300-
net_buf_simple_add(&cfm, 16))) {
300+
bt_mesh_prov_link.conf)) {
301301
BT_ERR("Unable to generate confirmation value");
302302
prov_fail(PROV_ERR_UNEXP_ERR);
303303
return;
304304
}
305305

306+
net_buf_simple_add_mem(&cfm, bt_mesh_prov_link.conf, 16);
307+
306308
if (bt_mesh_prov_send(&cfm, NULL)) {
307309
BT_ERR("Failed to send Provisioning Confirm");
308310
return;
@@ -610,6 +612,12 @@ static void prov_confirm(const uint8_t *data)
610612
{
611613
BT_DBG("Remote Confirm: %s", bt_hex(data, 16));
612614

615+
if (!memcmp(data, bt_mesh_prov_link.conf, 16)) {
616+
BT_ERR("Confirm value is identical to ours, rejecting.");
617+
prov_fail(PROV_ERR_CFM_FAILED);
618+
return;
619+
}
620+
613621
memcpy(bt_mesh_prov_link.conf, data, 16);
614622

615623
send_random();

0 commit comments

Comments
 (0)