mesh: Permit kr phase 0x00 to 0x03
MESH/NODE/KR/BI-01-C
Permit kr phase 0x00-->0x03
This is port of fe7eda6ac83f406c46b31fb0ea6bc0c0c2e93d84
diff --git a/nimble/host/mesh/src/subnet.c b/nimble/host/mesh/src/subnet.c
index cc889d3..c8f120c 100644
--- a/nimble/host/mesh/src/subnet.c
+++ b/nimble/host/mesh/src/subnet.c
@@ -83,6 +83,10 @@
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 @@
{
/* 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 */