Merge branch 'bugfix/sig_ble_mesh_errata_e16350_v4.2' into 'release/v4.2'

ble_mesh: stack: Apply the errata E16350 from Bluetooth SIG (v4.2)

See merge request espressif/esp-idf!15785
This commit is contained in:
Island 2021-11-05 03:09:15 +00:00
commit 78fc16d1d3

View File

@ -840,6 +840,7 @@ static void prov_start(const uint8_t *data)
static void send_confirm(void) static void send_confirm(void)
{ {
uint8_t *local_conf = NULL;
PROV_BUF(cfm, 17); PROV_BUF(cfm, 17);
BT_DBG("ConfInputs[0] %s", bt_hex(link.conf_inputs, 64)); BT_DBG("ConfInputs[0] %s", bt_hex(link.conf_inputs, 64));
@ -872,13 +873,21 @@ static void send_confirm(void)
prov_buf_init(&cfm, PROV_CONFIRM); prov_buf_init(&cfm, PROV_CONFIRM);
local_conf = net_buf_simple_add(&cfm, 16);
if (bt_mesh_prov_conf(link.conf_key, link.rand, link.auth, if (bt_mesh_prov_conf(link.conf_key, link.rand, link.auth,
net_buf_simple_add(&cfm, 16))) { local_conf)) {
BT_ERR("Unable to generate confirmation value"); BT_ERR("Unable to generate confirmation value");
prov_send_fail_msg(PROV_ERR_UNEXP_ERR); prov_send_fail_msg(PROV_ERR_UNEXP_ERR);
return; return;
} }
if (!memcmp(link.conf, local_conf, 16)) {
BT_ERR("Confirmation value is identical to ours, rejecting.");
prov_send_fail_msg(PROV_ERR_NVAL_FMT);
return;
}
if (prov_send(&cfm)) { if (prov_send(&cfm)) {
BT_ERR("Unable to send Provisioning Confirm"); BT_ERR("Unable to send Provisioning Confirm");
return; return;