mesh: Permit kr phase 0x00 to 0x03
MESH/NODE/KR/BI-01-C
Permit kr phase 0x00-->0x03
This is port of
@@ -83,6 +83,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]));
@@ -331,7 +335,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 */
