Bluetooth: Mesh: Permit kr phase 0x00 to 0x03

MESH/NODE/KR/BI-01-C
Permit kr phase 0x00-->0x03

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
Lingao Meng 2020-11-13 20:28:02 -08:00 committed by Johan Hedberg
commit fe7eda6ac8

View file

@ -82,6 +82,10 @@ static void key_refresh(struct bt_mesh_subnet *sub, uint8_t new_phase)
break;
/* Revoking keys */
case BT_MESH_KR_PHASE_3:
if (sub->kr_phase == BT_MESH_KR_NORMAL) {
return;
}
__fallthrough;
case BT_MESH_KR_NORMAL:
sub->kr_phase = BT_MESH_KR_NORMAL;
memcpy(&sub->keys[0], &sub->keys[1], sizeof(sub->keys[0]));
@ -330,7 +334,7 @@ uint8_t bt_mesh_subnet_kr_phase_set(uint16_t net_idx, uint8_t *phase)
{
/* Table in Bluetooth Mesh Profile Specification Section 4.2.14: */
const uint8_t valid_transitions[] = {
0x00, /* Normal phase: KR is started by key update */
BIT(BT_MESH_KR_PHASE_3), /* Normal phase: KR is started by key update */
BIT(BT_MESH_KR_PHASE_2) | BIT(BT_MESH_KR_PHASE_3), /* Phase 1 */
BIT(BT_MESH_KR_PHASE_3), /* Phase 2 */
/* Subnet is never in Phase 3 */