Skip to content

Commit 683e14c

Browse files
Johan Hedbergnashif
authored andcommitted
Bluetooth: Mesh: Fix Public Key mismatch error handling
Mismatch in Public Key type will cause device to send Invalid Format error, and treat any further PDU's as unexpected. This affects MESH/NODE/PROV/BI-03-C test case. Signed-off-by: Johan Hedberg <[email protected]>
1 parent ee79328 commit 683e14c

File tree

1 file changed

+7
-4
lines changed
  • subsys/bluetooth/host/mesh

1 file changed

+7
-4
lines changed

subsys/bluetooth/host/mesh/prov.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
#define INPUT_OOB_NUMBER 0x02
5454
#define INPUT_OOB_STRING 0x03
5555

56+
#define PUB_KEY_NO_OOB 0x00
57+
#define PUB_KEY_OOB 0x01
58+
5659
#define PROV_ERR_NONE 0x00
5760
#define PROV_ERR_NVAL_PDU 0x01
5861
#define PROV_ERR_NVAL_FMT 0x02
@@ -529,8 +532,8 @@ static void prov_invite(const u8_t *data)
529532
/* Supported algorithms - FIPS P-256 Eliptic Curve */
530533
net_buf_simple_add_be16(&buf, BIT(PROV_ALG_P256));
531534

532-
/* Public Key Type */
533-
net_buf_simple_add_u8(&buf, 0x00);
535+
/* Public Key Type, Only "No OOB" Public Key is supported */
536+
net_buf_simple_add_u8(&buf, PUB_KEY_NO_OOB);
534537

535538
/* Static OOB Type */
536539
net_buf_simple_add_u8(&buf, prov->static_val ? BIT(0) : 0x00);
@@ -729,8 +732,8 @@ static void prov_start(const u8_t *data)
729732
return;
730733
}
731734

732-
if (data[1] > 0x01) {
733-
BT_ERR("Invalid public key value: 0x%02x", data[1]);
735+
if (data[1] != PUB_KEY_NO_OOB) {
736+
BT_ERR("Invalid public key type: 0x%02x", data[1]);
734737
prov_send_fail_msg(PROV_ERR_NVAL_FMT);
735738
return;
736739
}

0 commit comments

Comments
 (0)