From d2b6e82b477729ff22bc5b3040fd03bbe3c55a79 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 23 May 2023 12:04:24 -0400 Subject: [PATCH] [nrf fromtree] Fix KeySetWrite command payload validation. (#26726) There are three fixes here: 1. Move the epoch key validity checks up front, since per spec those should happen before any internal state verification checks. 2. Add a check that the GroupKeySecurityPolicy in the keyset has a valid value for GroupKeySecurityPolicyEnum. 3. If we don't support MCSP, we should be failing out if the GroupKeySecurityPolicy is set to CacheAndSync. Fixes https://github.com/project-chip/connectedhomeip/issues/26692 --- .../group-key-mgmt-server.cpp | 63 ++- .../suites/TestGroupKeyManagementCluster.yaml | 91 +++- src/app/tests/suites/certification/PICS.yaml | 8 + .../tests/suites/certification/ci-pics-values | 7 +- .../chip-tool/zap-generated/test/Commands.h | 359 +++++++++---- .../zap-generated/test/Commands.h | 473 +++++++++++++----- 6 files changed, 754 insertions(+), 247 deletions(-) diff --git a/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp b/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp index 3591768762..135ab0d956 100644 --- a/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp +++ b/src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp @@ -109,6 +109,9 @@ class GroupKeyManagementAttributeAccess : public AttributeAccessInterface // Register for the GroupKeyManagement cluster on all endpoints. GroupKeyManagementAttributeAccess() : AttributeAccessInterface(Optional(0), GroupKeyManagement::Id) {} + // TODO: Once there is MCSP support, this may need to change. + static constexpr bool IsMCSPSupported() { return false; } + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override { VerifyOrDie(aPath.mClusterId == GroupKeyManagement::Id); @@ -117,8 +120,15 @@ class GroupKeyManagementAttributeAccess : public AttributeAccessInterface { case GroupKeyManagement::Attributes::ClusterRevision::Id: return ReadClusterRevision(aPath.mEndpointId, aEncoder); - case Attributes::FeatureMap::Id: - return aEncoder.Encode(static_cast(0)); + case Attributes::FeatureMap::Id: { + uint32_t features = 0; + if (IsMCSPSupported()) + { + // TODO: Once there is MCSP support, this will need to add the + // right feature bit. + } + return aEncoder.Encode(features); + } case GroupKeyManagement::Attributes::GroupKeyMap::Id: return ReadGroupKeyMap(aPath.mEndpointId, aEncoder); case GroupKeyManagement::Attributes::GroupTable::Id: @@ -296,29 +306,32 @@ bool emberAfGroupKeyManagementClusterKeySetWriteCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::DecodableType & commandData) { - auto provider = GetGroupDataProvider(); - auto fabric = Server::GetInstance().GetFabricTable().FindFabricWithIndex(commandObj->GetAccessingFabricIndex()); - - if (nullptr == provider || nullptr == fabric) + if (commandData.groupKeySet.epochKey0.IsNull() || commandData.groupKeySet.epochStartTime0.IsNull() || + commandData.groupKeySet.epochKey0.Value().empty() || (0 == commandData.groupKeySet.epochStartTime0.Value())) { - commandObj->AddStatus(commandPath, Status::Failure); + // If the EpochKey0 field is null or its associated EpochStartTime0 field is null, + // then this command SHALL fail with an INVALID_COMMAND + commandObj->AddStatus(commandPath, Status::InvalidCommand); return true; } - uint8_t compressed_fabric_id_buffer[sizeof(uint64_t)]; - MutableByteSpan compressed_fabric_id(compressed_fabric_id_buffer); - CHIP_ERROR err = fabric->GetCompressedFabricIdBytes(compressed_fabric_id); - if (CHIP_NO_ERROR != err) + if (commandData.groupKeySet.groupKeySecurityPolicy == GroupKeySecurityPolicyEnum::kUnknownEnumValue) { - commandObj->AddStatus(commandPath, Status::Failure); + // If a client indicates an enumeration value to the server, that is not + // supported by the server, because it is ... a new value unrecognized + // by a legacy server, then the server SHALL generate a general + // constraint error + commandObj->AddStatus(commandPath, Status::ConstraintError); return true; } - if (commandData.groupKeySet.epochKey0.IsNull() || commandData.groupKeySet.epochStartTime0.IsNull() || - commandData.groupKeySet.epochKey0.Value().empty() || (0 == commandData.groupKeySet.epochStartTime0.Value())) + if (!GroupKeyManagementAttributeAccess::IsMCSPSupported() && + commandData.groupKeySet.groupKeySecurityPolicy == GroupKeySecurityPolicyEnum::kCacheAndSync) { - // If the EpochKey0 field is null or its associated EpochStartTime0 field is null, - // then this command SHALL fail with an INVALID_COMMAND + // When CacheAndSync is not supported in the FeatureMap of this cluster, + // any action attempting to set CacheAndSync in the + // GroupKeySecurityPolicy field SHALL fail with an INVALID_COMMAND + // error. commandObj->AddStatus(commandPath, Status::InvalidCommand); return true; } @@ -366,6 +379,24 @@ bool emberAfGroupKeyManagementClusterKeySetWriteCallback( keyset.num_keys_used++; } + auto provider = GetGroupDataProvider(); + auto fabric = Server::GetInstance().GetFabricTable().FindFabricWithIndex(commandObj->GetAccessingFabricIndex()); + + if (nullptr == provider || nullptr == fabric) + { + commandObj->AddStatus(commandPath, Status::Failure); + return true; + } + + uint8_t compressed_fabric_id_buffer[sizeof(uint64_t)]; + MutableByteSpan compressed_fabric_id(compressed_fabric_id_buffer); + CHIP_ERROR err = fabric->GetCompressedFabricIdBytes(compressed_fabric_id); + if (CHIP_NO_ERROR != err) + { + commandObj->AddStatus(commandPath, Status::Failure); + return true; + } + // Set KeySet err = provider->SetKeySet(fabric->GetFabricIndex(), compressed_fabric_id, keyset); if (CHIP_NO_ERROR == err) diff --git a/src/app/tests/suites/TestGroupKeyManagementCluster.yaml b/src/app/tests/suites/TestGroupKeyManagementCluster.yaml index 9474d98c22..4aedb61d7e 100644 --- a/src/app/tests/suites/TestGroupKeyManagementCluster.yaml +++ b/src/app/tests/suites/TestGroupKeyManagementCluster.yaml @@ -91,8 +91,9 @@ tests: EpochStartTime2: 1110002, } - - label: "KeySet Write 2" + - label: "KeySet Write 2 CacheAndSync" command: "KeySetWrite" + PICS: GRPKEY.S.F00 arguments: values: - name: "GroupKeySet" @@ -108,9 +109,28 @@ tests: EpochStartTime2: 2110002, } - - label: "KeySet Write 3" + - label: "KeySet Write 2 TrustFirst" + command: "KeySetWrite" + PICS: "!GRPKEY.S.F00" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a2, + GroupKeySecurityPolicy: 0, + EpochKey0: "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf", + EpochStartTime0: 2110000, + EpochKey1: "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef", + EpochStartTime1: 2110001, + EpochKey2: "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", + EpochStartTime2: 2110002, + } + + - label: "KeySet Write 3 CacheAndSync" identity: "beta" command: "KeySetWrite" + PICS: GRPKEY.S.F00 arguments: values: - name: "GroupKeySet" @@ -128,6 +148,27 @@ tests: EpochStartTime2: 2110002, } + - label: "KeySet Write 3 TrustFirst" + identity: "beta" + command: "KeySetWrite" + PICS: "!GRPKEY.S.F00" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a3, + GroupKeySecurityPolicy: 0, + EpochKey0: + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", + EpochStartTime0: 2110000, + EpochKey1: "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", + EpochStartTime1: 2110001, + EpochKey2: + "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f", + EpochStartTime2: 2110002, + } + - label: "KeySet Read" command: "KeySetRead" arguments: @@ -502,8 +543,9 @@ tests: response: error: NOT_FOUND - - label: "KeySet Read (not removed)" + - label: "KeySet Read (not removed) CacheAndSync" command: "KeySetRead" + PICS: GRPKEY.S.F00 arguments: values: - name: "GroupKeySetID" @@ -523,6 +565,28 @@ tests: EpochStartTime2: 2110002, } + - label: "KeySet Read (not removed) TrustFirst" + command: "KeySetRead" + PICS: GRPKEY.S.F00 + arguments: + values: + - name: "GroupKeySetID" + value: 0x01a2 + response: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a2, + GroupKeySecurityPolicy: 0, + EpochKey0: null, + EpochStartTime0: 2110000, + EpochKey1: null, + EpochStartTime1: 2110001, + EpochKey2: null, + EpochStartTime2: 2110002, + } + - label: "Remove Group 1" cluster: "Groups" endpoint: 1 @@ -608,8 +672,9 @@ tests: EpochStartTime2: 1110002, } - - label: "KeySet Write 2" + - label: "KeySet Write 2 CacheAndSync" command: "KeySetWrite" + PICS: GRPKEY.S.F00 arguments: values: - name: "GroupKeySet" @@ -625,6 +690,24 @@ tests: EpochStartTime2: 2110002, } + - label: "KeySet Write 2 TrustFirst" + command: "KeySetWrite" + PICS: "!GRPKEY.S.F00" + arguments: + values: + - name: "GroupKeySet" + value: + { + GroupKeySetID: 0x01a2, + GroupKeySecurityPolicy: 0, + EpochKey0: "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf", + EpochStartTime0: 2110000, + EpochKey1: "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef", + EpochStartTime1: 2110001, + EpochKey2: "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff", + EpochStartTime2: 2110002, + } + - label: "Map Group 1 and Group 2 to KeySet 1 and group 2 to KeySet 2" command: "writeAttribute" attribute: "GroupKeyMap" diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 6c08289dbc..386b3435b7 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -3386,6 +3386,14 @@ PICS: client?" id: GRPKEY.C + # + # server / features + # + - label: + "Does the DUT(Server) support Group Key Management CacheAndSync + feature?" + id: GRPKEY.S.F00 + # # client / attributes # diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index c2aeee0e6a..dab60bab0a 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -566,9 +566,12 @@ G.C.C03.Tx=0 G.C.C04.Tx=0 G.C.C05.Tx=0 -GRPKEY.C=1 -GRPKEY.S.A0001=0 GRPKEY.S=1 +# No support for the CacheAndSync feature so far +GRPKEY.S.F00=0 +GRPKEY.S.A0001=0 + +GRPKEY.C=1 GRPKEY.C.A0000=1 GRPKEY.C.A0001=0 GRPKEY.C.C00.Tx=1 diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index f84ae4b309..8792017f5d 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -88208,7 +88208,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand { public: TestGroupKeyManagementClusterSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestGroupKeyManagementCluster", 43, credsIssuerConfig) + TestCommand("TestGroupKeyManagementCluster", 47, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -88284,6 +88284,12 @@ class TestGroupKeyManagementClusterSuite : public TestCommand VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType value; @@ -88304,19 +88310,19 @@ class TestGroupKeyManagementClusterSuite : public TestCommand CheckValue("groupKeySet.epochStartTime2.Value()", value.groupKeySet.epochStartTime2.Value(), 1110002ULL)); } break; - case 10: + case 12: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; - case 11: + case 13: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; - case 12: + case 14: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 13: + case 15: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 14: + case 16: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -88345,7 +88351,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 15: + case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -88390,7 +88396,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 16: + case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -88419,7 +88425,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 17: + case 19: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -88464,7 +88470,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 18: + case 20: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; @@ -88473,7 +88479,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); } break; - case 19: + case 21: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; @@ -88482,7 +88488,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand VerifyOrReturn(CheckValue("groupID", value.groupID, 258U)); } break; - case 20: + case 22: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; @@ -88491,7 +88497,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand VerifyOrReturn(CheckValue("groupID", value.groupID, 259U)); } break; - case 21: + case 23: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; @@ -88500,7 +88506,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand VerifyOrReturn(CheckValue("groupID", value.groupID, 260U)); } break; - case 22: + case 24: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::AddGroupResponse::DecodableType value; @@ -88509,7 +88515,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand VerifyOrReturn(CheckValue("groupID", value.groupID, 261U)); } break; - case 23: + case 25: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -88578,7 +88584,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 24: + case 26: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -88661,7 +88667,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 25: + case 27: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -88688,7 +88694,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 26: + case 28: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -88771,13 +88777,13 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 27: + case 29: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 28: + case 30: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); break; - case 29: + case 31: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType value; @@ -88798,7 +88804,28 @@ class TestGroupKeyManagementClusterSuite : public TestCommand CheckValue("groupKeySet.epochStartTime2.Value()", value.groupKeySet.epochStartTime2.Value(), 2110002ULL)); } break; - case 30: + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("groupKeySet.groupKeySetID", value.groupKeySet.groupKeySetID, 418U)); + VerifyOrReturn(CheckValue("groupKeySet.groupKeySecurityPolicy", value.groupKeySet.groupKeySecurityPolicy, 0U)); + VerifyOrReturn(CheckValueNull("groupKeySet.epochKey0", value.groupKeySet.epochKey0)); + VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime0", value.groupKeySet.epochStartTime0)); + VerifyOrReturn( + CheckValue("groupKeySet.epochStartTime0.Value()", value.groupKeySet.epochStartTime0.Value(), 2110000ULL)); + VerifyOrReturn(CheckValueNull("groupKeySet.epochKey1", value.groupKeySet.epochKey1)); + VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime1", value.groupKeySet.epochStartTime1)); + VerifyOrReturn( + CheckValue("groupKeySet.epochStartTime1.Value()", value.groupKeySet.epochStartTime1.Value(), 2110001ULL)); + VerifyOrReturn(CheckValueNull("groupKeySet.epochKey2", value.groupKeySet.epochKey2)); + VerifyOrReturn(CheckValueNonNull("groupKeySet.epochStartTime2", value.groupKeySet.epochStartTime2)); + VerifyOrReturn( + CheckValue("groupKeySet.epochStartTime2.Value()", value.groupKeySet.epochStartTime2.Value(), 2110002ULL)); + } + break; + case 33: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::Clusters::Groups::Commands::RemoveGroupResponse::DecodableType value; @@ -88807,7 +88834,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand VerifyOrReturn(CheckValue("groupID", value.groupID, 257U)); } break; - case 31: + case 34: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -88862,10 +88889,10 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 32: + case 35: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 33: + case 36: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -88878,25 +88905,28 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 34: + case 37: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 35: + case 38: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); break; - case 36: + case 39: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 37: + case 40: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 38: + case 41: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 39: + case 42: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 40: + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 44: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -88913,10 +88943,10 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 41: + case 45: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; - case 42: + case 46: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -89023,7 +89053,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } case 7: { - LogStep(7, "KeySet Write 2"); + LogStep(7, "KeySet Write 2 CacheAndSync"); + VerifyOrDo(!ShouldSkip("GRPKEY.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; @@ -89058,7 +89089,44 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } case 8: { - LogStep(8, "KeySet Write 3"); + LogStep(8, "KeySet Write 2 TrustFirst"); + VerifyOrDo(!ShouldSkip("!GRPKEY.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; + + value.groupKeySet.groupKeySetID = 418U; + value.groupKeySet.groupKeySecurityPolicy = + static_cast(0); + value.groupKeySet.epochKey0.SetNonNull(); + value.groupKeySet.epochKey0.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime0.SetNonNull(); + value.groupKeySet.epochStartTime0.Value() = 2110000ULL; + value.groupKeySet.epochKey1.SetNonNull(); + value.groupKeySet.epochKey1.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime1.SetNonNull(); + value.groupKeySet.epochStartTime1.Value() = 2110001ULL; + value.groupKeySet.epochKey2.SetNonNull(); + value.groupKeySet.epochKey2.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime2.SetNonNull(); + value.groupKeySet.epochStartTime2.Value() = 2110002ULL; + + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional + + ); + } + case 9: { + LogStep(9, "KeySet Write 3 CacheAndSync"); + VerifyOrDo(!ShouldSkip("GRPKEY.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; @@ -89090,8 +89158,42 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 9: { - LogStep(9, "KeySet Read"); + case 10: { + LogStep(10, "KeySet Write 3 TrustFirst"); + VerifyOrDo(!ShouldSkip("!GRPKEY.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; + + value.groupKeySet.groupKeySetID = 419U; + value.groupKeySet.groupKeySecurityPolicy = + static_cast(0); + value.groupKeySet.epochKey0.SetNonNull(); + value.groupKeySet.epochKey0.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime0.SetNonNull(); + value.groupKeySet.epochStartTime0.Value() = 2110000ULL; + value.groupKeySet.epochKey1.SetNonNull(); + value.groupKeySet.epochKey1.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime1.SetNonNull(); + value.groupKeySet.epochStartTime1.Value() = 2110001ULL; + value.groupKeySet.epochKey2.SetNonNull(); + value.groupKeySet.epochKey2.Value() = + chip::ByteSpan(chip::Uint8::from_const_char(" !\042#$%&'()*+,-./garbage: not in length on purpose"), 16); + value.groupKeySet.epochStartTime2.SetNonNull(); + value.groupKeySet.epochStartTime2.Value() = 2110002ULL; + + return SendCommand(kIdentityBeta, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Commands::KeySetWrite::Id, + value, chip::NullOptional + + ); + } + case 11: { + LogStep(11, "KeySet Read"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; value.groupKeySetID = 417U; @@ -89100,8 +89202,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 10: { - LogStep(10, "Write Group Keys (invalid)"); + case 12: { + LogStep(12, "Write Group Keys (invalid)"); ListFreer listFreer; chip::app::DataModel::List value; @@ -89119,8 +89221,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); } - case 11: { - LogStep(11, "Write Group Keys (too many)"); + case 13: { + LogStep(13, "Write Group Keys (too many)"); ListFreer listFreer; chip::app::DataModel::List value; @@ -89190,8 +89292,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); } - case 12: { - LogStep(12, "Write Group Keys on alpha"); + case 14: { + LogStep(14, "Write Group Keys on alpha"); ListFreer listFreer; chip::app::DataModel::List value; @@ -89221,8 +89323,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); } - case 13: { - LogStep(13, "Write Group Keys on beta"); + case 15: { + LogStep(15, "Write Group Keys on beta"); ListFreer listFreer; chip::app::DataModel::List value; @@ -89252,28 +89354,28 @@ class TestGroupKeyManagementClusterSuite : public TestCommand return WriteAttribute(kIdentityBeta, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); } - case 14: { - LogStep(14, "Read Group Keys on alpha"); + case 16: { + LogStep(16, "Read Group Keys on alpha"); return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, true, chip::NullOptional); } - case 15: { - LogStep(15, "Read Group Keys on alpha without fabric filtering"); + case 17: { + LogStep(17, "Read Group Keys on alpha without fabric filtering"); return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, false, chip::NullOptional); } - case 16: { - LogStep(16, "Read Group Keys on beta"); + case 18: { + LogStep(18, "Read Group Keys on beta"); return ReadAttribute(kIdentityBeta, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, true, chip::NullOptional); } - case 17: { - LogStep(17, "Read Group Keys on beta without fabric filtering"); + case 19: { + LogStep(19, "Read Group Keys on beta without fabric filtering"); return ReadAttribute(kIdentityBeta, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, false, chip::NullOptional); } - case 18: { - LogStep(18, "Add Group 1"); + case 20: { + LogStep(20, "Add Group 1"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::AddGroup::Type value; value.groupID = 257U; @@ -89282,8 +89384,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 19: { - LogStep(19, "Add Group 2"); + case 21: { + LogStep(21, "Add Group 2"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::AddGroup::Type value; value.groupID = 258U; @@ -89292,8 +89394,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 20: { - LogStep(20, "Add Group 3"); + case 22: { + LogStep(22, "Add Group 3"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::AddGroup::Type value; value.groupID = 259U; @@ -89302,8 +89404,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 21: { - LogStep(21, "Add Group 4"); + case 23: { + LogStep(23, "Add Group 4"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::AddGroup::Type value; value.groupID = 260U; @@ -89312,8 +89414,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 22: { - LogStep(22, "Add Group 5"); + case 24: { + LogStep(24, "Add Group 5"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::AddGroup::Type value; value.groupID = 261U; @@ -89322,28 +89424,28 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 23: { - LogStep(23, "Read GroupTable from alpha"); + case 25: { + LogStep(25, "Read GroupTable from alpha"); return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupTable::Id, true, chip::NullOptional); } - case 24: { - LogStep(24, "Read GroupTable from alpha without fabric filtering"); + case 26: { + LogStep(26, "Read GroupTable from alpha without fabric filtering"); return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupTable::Id, false, chip::NullOptional); } - case 25: { - LogStep(25, "Read GroupTable from beta"); + case 27: { + LogStep(27, "Read GroupTable from beta"); return ReadAttribute(kIdentityBeta, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupTable::Id, true, chip::NullOptional); } - case 26: { - LogStep(26, "Read GroupTable from beta without fabric filtering"); + case 28: { + LogStep(28, "Read GroupTable from beta without fabric filtering"); return ReadAttribute(kIdentityBeta, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupTable::Id, false, chip::NullOptional); } - case 27: { - LogStep(27, "KeySet Remove 1"); + case 29: { + LogStep(29, "KeySet Remove 1"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type value; value.groupKeySetID = 417U; @@ -89352,8 +89454,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 28: { - LogStep(28, "KeySet Read (removed)"); + case 30: { + LogStep(30, "KeySet Read (removed)"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; value.groupKeySetID = 417U; @@ -89362,8 +89464,9 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 29: { - LogStep(29, "KeySet Read (not removed)"); + case 31: { + LogStep(31, "KeySet Read (not removed) CacheAndSync"); + VerifyOrDo(!ShouldSkip("GRPKEY.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; value.groupKeySetID = 418U; @@ -89372,8 +89475,19 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 30: { - LogStep(30, "Remove Group 1"); + case 32: { + LogStep(32, "KeySet Read (not removed) TrustFirst"); + VerifyOrDo(!ShouldSkip("GRPKEY.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; + value.groupKeySetID = 418U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Commands::KeySetRead::Id, + value, chip::NullOptional + + ); + } + case 33: { + LogStep(33, "Remove Group 1"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::RemoveGroup::Type value; value.groupID = 257U; @@ -89382,13 +89496,13 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 31: { - LogStep(31, "Read GroupTable 2"); + case 34: { + LogStep(34, "Read GroupTable 2"); return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupTable::Id, true, chip::NullOptional); } - case 32: { - LogStep(32, "Remove All"); + case 35: { + LogStep(35, "Remove All"); ListFreer listFreer; chip::app::Clusters::Groups::Commands::RemoveAllGroups::Type value; return SendCommand(kIdentityAlpha, GetEndpoint(1), Groups::Id, Groups::Commands::RemoveAllGroups::Id, value, @@ -89396,13 +89510,13 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 33: { - LogStep(33, "Read GroupTable 3"); + case 36: { + LogStep(36, "Read GroupTable 3"); return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupTable::Id, true, chip::NullOptional); } - case 34: { - LogStep(34, "KeySet Remove 2"); + case 37: { + LogStep(37, "KeySet Remove 2"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type value; value.groupKeySetID = 418U; @@ -89411,8 +89525,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 35: { - LogStep(35, "KeySet Read (also removed)"); + case 38: { + LogStep(38, "KeySet Read (also removed)"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type value; value.groupKeySetID = 418U; @@ -89421,8 +89535,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 36: { - LogStep(36, "KeySet Write 1"); + case 39: { + LogStep(39, "KeySet Write 1"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; @@ -89456,8 +89570,9 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 37: { - LogStep(37, "KeySet Write 2"); + case 40: { + LogStep(40, "KeySet Write 2 CacheAndSync"); + VerifyOrDo(!ShouldSkip("GRPKEY.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; @@ -89491,8 +89606,44 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 38: { - LogStep(38, "Map Group 1 and Group 2 to KeySet 1 and group 2 to KeySet 2"); + case 41: { + LogStep(41, "KeySet Write 2 TrustFirst"); + VerifyOrDo(!ShouldSkip("!GRPKEY.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + ListFreer listFreer; + chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type value; + + value.groupKeySet.groupKeySetID = 418U; + value.groupKeySet.groupKeySecurityPolicy = + static_cast(0); + value.groupKeySet.epochKey0.SetNonNull(); + value.groupKeySet.epochKey0.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime0.SetNonNull(); + value.groupKeySet.epochStartTime0.Value() = 2110000ULL; + value.groupKeySet.epochKey1.SetNonNull(); + value.groupKeySet.epochKey1.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime1.SetNonNull(); + value.groupKeySet.epochStartTime1.Value() = 2110001ULL; + value.groupKeySet.epochKey2.SetNonNull(); + value.groupKeySet.epochKey2.Value() = chip::ByteSpan( + chip::Uint8::from_const_char( + "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377garbage: not in length on purpose"), + 16); + value.groupKeySet.epochStartTime2.SetNonNull(); + value.groupKeySet.epochStartTime2.Value() = 2110002ULL; + + return SendCommand(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, + GroupKeyManagement::Commands::KeySetWrite::Id, value, chip::NullOptional + + ); + } + case 42: { + LogStep(42, "Map Group 1 and Group 2 to KeySet 1 and group 2 to KeySet 2"); ListFreer listFreer; chip::app::DataModel::List value; @@ -89518,8 +89669,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, value, chip::NullOptional, chip::NullOptional); } - case 39: { - LogStep(39, "Remove keyset 1"); + case 43: { + LogStep(43, "Remove keyset 1"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type value; value.groupKeySetID = 417U; @@ -89528,13 +89679,13 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 40: { - LogStep(40, "TH verifies GroupKeyMap entries for KeySet 1 have been removed"); + case 44: { + LogStep(44, "TH verifies GroupKeyMap entries for KeySet 1 have been removed"); return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, true, chip::NullOptional); } - case 41: { - LogStep(41, "Remove keyset 2"); + case 45: { + LogStep(45, "Remove keyset 2"); ListFreer listFreer; chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type value; value.groupKeySetID = 418U; @@ -89543,8 +89694,8 @@ class TestGroupKeyManagementClusterSuite : public TestCommand ); } - case 42: { - LogStep(42, "TH verifies GroupKeyMap entries for KeySet 2 have been removed"); + case 46: { + LogStep(46, "TH verifies GroupKeyMap entries for KeySet 2 have been removed"); return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GroupKeyManagement::Id, GroupKeyManagement::Attributes::GroupKeyMap::Id, true, chip::NullOptional); } diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 2ac0dea95d..87c813e0cc 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -134726,148 +134726,196 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { err = TestKeySetWrite1_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : KeySet Write 2\n"); - err = TestKeySetWrite2_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : KeySet Write 2 CacheAndSync\n"); + if (ShouldSkip("GRPKEY.S.F00")) { + NextTest(); + return; + } + err = TestKeySetWrite2CacheAndSync_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : KeySet Write 3\n"); - err = TestKeySetWrite3_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : KeySet Write 2 TrustFirst\n"); + if (ShouldSkip("!GRPKEY.S.F00")) { + NextTest(); + return; + } + err = TestKeySetWrite2TrustFirst_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : KeySet Read\n"); - err = TestKeySetRead_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : KeySet Write 3 CacheAndSync\n"); + if (ShouldSkip("GRPKEY.S.F00")) { + NextTest(); + return; + } + err = TestKeySetWrite3CacheAndSync_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Write Group Keys (invalid)\n"); - err = TestWriteGroupKeysInvalid_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : KeySet Write 3 TrustFirst\n"); + if (ShouldSkip("!GRPKEY.S.F00")) { + NextTest(); + return; + } + err = TestKeySetWrite3TrustFirst_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Write Group Keys (too many)\n"); - err = TestWriteGroupKeysTooMany_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : KeySet Read\n"); + err = TestKeySetRead_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Write Group Keys on alpha\n"); - err = TestWriteGroupKeysOnAlpha_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Write Group Keys (invalid)\n"); + err = TestWriteGroupKeysInvalid_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Write Group Keys on beta\n"); - err = TestWriteGroupKeysOnBeta_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Write Group Keys (too many)\n"); + err = TestWriteGroupKeysTooMany_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Read Group Keys on alpha\n"); - err = TestReadGroupKeysOnAlpha_14(); + ChipLogProgress(chipTool, " ***** Test Step 14 : Write Group Keys on alpha\n"); + err = TestWriteGroupKeysOnAlpha_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Read Group Keys on alpha without fabric filtering\n"); - err = TestReadGroupKeysOnAlphaWithoutFabricFiltering_15(); + ChipLogProgress(chipTool, " ***** Test Step 15 : Write Group Keys on beta\n"); + err = TestWriteGroupKeysOnBeta_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Read Group Keys on beta\n"); - err = TestReadGroupKeysOnBeta_16(); + ChipLogProgress(chipTool, " ***** Test Step 16 : Read Group Keys on alpha\n"); + err = TestReadGroupKeysOnAlpha_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Read Group Keys on beta without fabric filtering\n"); - err = TestReadGroupKeysOnBetaWithoutFabricFiltering_17(); + ChipLogProgress(chipTool, " ***** Test Step 17 : Read Group Keys on alpha without fabric filtering\n"); + err = TestReadGroupKeysOnAlphaWithoutFabricFiltering_17(); break; case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Add Group 1\n"); - err = TestAddGroup1_18(); + ChipLogProgress(chipTool, " ***** Test Step 18 : Read Group Keys on beta\n"); + err = TestReadGroupKeysOnBeta_18(); break; case 19: - ChipLogProgress(chipTool, " ***** Test Step 19 : Add Group 2\n"); - err = TestAddGroup2_19(); + ChipLogProgress(chipTool, " ***** Test Step 19 : Read Group Keys on beta without fabric filtering\n"); + err = TestReadGroupKeysOnBetaWithoutFabricFiltering_19(); break; case 20: - ChipLogProgress(chipTool, " ***** Test Step 20 : Add Group 3\n"); - err = TestAddGroup3_20(); + ChipLogProgress(chipTool, " ***** Test Step 20 : Add Group 1\n"); + err = TestAddGroup1_20(); break; case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Add Group 4\n"); - err = TestAddGroup4_21(); + ChipLogProgress(chipTool, " ***** Test Step 21 : Add Group 2\n"); + err = TestAddGroup2_21(); break; case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Add Group 5\n"); - err = TestAddGroup5_22(); + ChipLogProgress(chipTool, " ***** Test Step 22 : Add Group 3\n"); + err = TestAddGroup3_22(); break; case 23: - ChipLogProgress(chipTool, " ***** Test Step 23 : Read GroupTable from alpha\n"); - err = TestReadGroupTableFromAlpha_23(); + ChipLogProgress(chipTool, " ***** Test Step 23 : Add Group 4\n"); + err = TestAddGroup4_23(); break; case 24: - ChipLogProgress(chipTool, " ***** Test Step 24 : Read GroupTable from alpha without fabric filtering\n"); - err = TestReadGroupTableFromAlphaWithoutFabricFiltering_24(); + ChipLogProgress(chipTool, " ***** Test Step 24 : Add Group 5\n"); + err = TestAddGroup5_24(); break; case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Read GroupTable from beta\n"); - err = TestReadGroupTableFromBeta_25(); + ChipLogProgress(chipTool, " ***** Test Step 25 : Read GroupTable from alpha\n"); + err = TestReadGroupTableFromAlpha_25(); break; case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Read GroupTable from beta without fabric filtering\n"); - err = TestReadGroupTableFromBetaWithoutFabricFiltering_26(); + ChipLogProgress(chipTool, " ***** Test Step 26 : Read GroupTable from alpha without fabric filtering\n"); + err = TestReadGroupTableFromAlphaWithoutFabricFiltering_26(); break; case 27: - ChipLogProgress(chipTool, " ***** Test Step 27 : KeySet Remove 1\n"); - err = TestKeySetRemove1_27(); + ChipLogProgress(chipTool, " ***** Test Step 27 : Read GroupTable from beta\n"); + err = TestReadGroupTableFromBeta_27(); break; case 28: - ChipLogProgress(chipTool, " ***** Test Step 28 : KeySet Read (removed)\n"); - err = TestKeySetReadRemoved_28(); + ChipLogProgress(chipTool, " ***** Test Step 28 : Read GroupTable from beta without fabric filtering\n"); + err = TestReadGroupTableFromBetaWithoutFabricFiltering_28(); break; case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : KeySet Read (not removed)\n"); - err = TestKeySetReadNotRemoved_29(); + ChipLogProgress(chipTool, " ***** Test Step 29 : KeySet Remove 1\n"); + err = TestKeySetRemove1_29(); break; case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Remove Group 1\n"); - err = TestRemoveGroup1_30(); + ChipLogProgress(chipTool, " ***** Test Step 30 : KeySet Read (removed)\n"); + err = TestKeySetReadRemoved_30(); break; case 31: - ChipLogProgress(chipTool, " ***** Test Step 31 : Read GroupTable 2\n"); - err = TestReadGroupTable2_31(); + ChipLogProgress(chipTool, " ***** Test Step 31 : KeySet Read (not removed) CacheAndSync\n"); + if (ShouldSkip("GRPKEY.S.F00")) { + NextTest(); + return; + } + err = TestKeySetReadNotRemovedCacheAndSync_31(); break; case 32: - ChipLogProgress(chipTool, " ***** Test Step 32 : Remove All\n"); - err = TestRemoveAll_32(); + ChipLogProgress(chipTool, " ***** Test Step 32 : KeySet Read (not removed) TrustFirst\n"); + if (ShouldSkip("GRPKEY.S.F00")) { + NextTest(); + return; + } + err = TestKeySetReadNotRemovedTrustFirst_32(); break; case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Read GroupTable 3\n"); - err = TestReadGroupTable3_33(); + ChipLogProgress(chipTool, " ***** Test Step 33 : Remove Group 1\n"); + err = TestRemoveGroup1_33(); break; case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : KeySet Remove 2\n"); - err = TestKeySetRemove2_34(); + ChipLogProgress(chipTool, " ***** Test Step 34 : Read GroupTable 2\n"); + err = TestReadGroupTable2_34(); break; case 35: - ChipLogProgress(chipTool, " ***** Test Step 35 : KeySet Read (also removed)\n"); - err = TestKeySetReadAlsoRemoved_35(); + ChipLogProgress(chipTool, " ***** Test Step 35 : Remove All\n"); + err = TestRemoveAll_35(); break; case 36: - ChipLogProgress(chipTool, " ***** Test Step 36 : KeySet Write 1\n"); - err = TestKeySetWrite1_36(); + ChipLogProgress(chipTool, " ***** Test Step 36 : Read GroupTable 3\n"); + err = TestReadGroupTable3_36(); break; case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : KeySet Write 2\n"); - err = TestKeySetWrite2_37(); + ChipLogProgress(chipTool, " ***** Test Step 37 : KeySet Remove 2\n"); + err = TestKeySetRemove2_37(); break; case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Map Group 1 and Group 2 to KeySet 1 and group 2 to KeySet 2\n"); - err = TestMapGroup1AndGroup2ToKeySet1AndGroup2ToKeySet2_38(); + ChipLogProgress(chipTool, " ***** Test Step 38 : KeySet Read (also removed)\n"); + err = TestKeySetReadAlsoRemoved_38(); break; case 39: - ChipLogProgress(chipTool, " ***** Test Step 39 : Remove keyset 1\n"); - err = TestRemoveKeyset1_39(); + ChipLogProgress(chipTool, " ***** Test Step 39 : KeySet Write 1\n"); + err = TestKeySetWrite1_39(); break; case 40: - ChipLogProgress(chipTool, " ***** Test Step 40 : TH verifies GroupKeyMap entries for KeySet 1 have been removed\n"); - err = TestThVerifiesGroupKeyMapEntriesForKeySet1HaveBeenRemoved_40(); + ChipLogProgress(chipTool, " ***** Test Step 40 : KeySet Write 2 CacheAndSync\n"); + if (ShouldSkip("GRPKEY.S.F00")) { + NextTest(); + return; + } + err = TestKeySetWrite2CacheAndSync_40(); break; case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Remove keyset 2\n"); - err = TestRemoveKeyset2_41(); + ChipLogProgress(chipTool, " ***** Test Step 41 : KeySet Write 2 TrustFirst\n"); + if (ShouldSkip("!GRPKEY.S.F00")) { + NextTest(); + return; + } + err = TestKeySetWrite2TrustFirst_41(); break; case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : TH verifies GroupKeyMap entries for KeySet 2 have been removed\n"); - err = TestThVerifiesGroupKeyMapEntriesForKeySet2HaveBeenRemoved_42(); + ChipLogProgress(chipTool, " ***** Test Step 42 : Map Group 1 and Group 2 to KeySet 1 and group 2 to KeySet 2\n"); + err = TestMapGroup1AndGroup2ToKeySet1AndGroup2ToKeySet2_42(); + break; + case 43: + ChipLogProgress(chipTool, " ***** Test Step 43 : Remove keyset 1\n"); + err = TestRemoveKeyset1_43(); + break; + case 44: + ChipLogProgress(chipTool, " ***** Test Step 44 : TH verifies GroupKeyMap entries for KeySet 1 have been removed\n"); + err = TestThVerifiesGroupKeyMapEntriesForKeySet1HaveBeenRemoved_44(); + break; + case 45: + ChipLogProgress(chipTool, " ***** Test Step 45 : Remove keyset 2\n"); + err = TestRemoveKeyset2_45(); + break; + case 46: + ChipLogProgress(chipTool, " ***** Test Step 46 : TH verifies GroupKeyMap entries for KeySet 2 have been removed\n"); + err = TestThVerifiesGroupKeyMapEntriesForKeySet2HaveBeenRemoved_46(); break; } @@ -134911,16 +134959,16 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 12: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); break; case 13: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_FAILURE)); break; case 14: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -134965,13 +135013,13 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 28: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 29: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 30: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); break; case 31: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -134986,7 +135034,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 35: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 36: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -134995,7 +135043,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; case 38: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_NOT_FOUND)); break; case 39: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); @@ -135009,6 +135057,18 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { case 42: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); break; + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 44: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; } // Go on to the next test. @@ -135022,7 +135082,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 43; + const uint16_t mTestCount = 47; chip::Optional mNodeId; chip::Optional mCluster; @@ -135162,7 +135222,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetWrite2_7() + CHIP_ERROR TestKeySetWrite2CacheAndSync_7() { MTRBaseDevice * device = GetDevice("alpha"); @@ -135192,7 +135252,47 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { [cluster keySetWriteWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"KeySet Write 2 Error: %@", err); + NSLog(@"KeySet Write 2 CacheAndSync Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestKeySetWrite2TrustFirst_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupKeyManagementClusterKeySetWriteParams alloc] init]; + params.groupKeySet = [[MTRGroupKeyManagementClusterGroupKeySetStruct alloc] init]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySetID = + [NSNumber numberWithUnsignedShort:418U]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySecurityPolicy = + [NSNumber numberWithUnsignedChar:0U]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey0 = + [[NSData alloc] initWithBytes:"\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337" length:16]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime0 = + [NSNumber numberWithUnsignedLongLong:2110000ULL]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey1 = + [[NSData alloc] initWithBytes:"\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357" length:16]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime1 = + [NSNumber numberWithUnsignedLongLong:2110001ULL]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey2 = + [[NSData alloc] initWithBytes:"\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377" length:16]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime2 = + [NSNumber numberWithUnsignedLongLong:2110002ULL]; + + [cluster keySetWriteWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"KeySet Write 2 TrustFirst Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -135202,7 +135302,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetWrite3_8() + CHIP_ERROR TestKeySetWrite3CacheAndSync_9() { MTRBaseDevice * device = GetDevice("beta"); @@ -135232,7 +135332,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { [cluster keySetWriteWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"KeySet Write 3 Error: %@", err); + NSLog(@"KeySet Write 3 CacheAndSync Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -135242,7 +135342,47 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetRead_9() + CHIP_ERROR TestKeySetWrite3TrustFirst_10() + { + + MTRBaseDevice * device = GetDevice("beta"); + __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupKeyManagementClusterKeySetWriteParams alloc] init]; + params.groupKeySet = [[MTRGroupKeyManagementClusterGroupKeySetStruct alloc] init]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySetID = + [NSNumber numberWithUnsignedShort:419U]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySecurityPolicy = + [NSNumber numberWithUnsignedChar:0U]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey0 = + [[NSData alloc] initWithBytes:"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017" length:16]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime0 = + [NSNumber numberWithUnsignedLongLong:2110000ULL]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey1 = + [[NSData alloc] initWithBytes:"\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" length:16]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime1 = + [NSNumber numberWithUnsignedLongLong:2110001ULL]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey2 = + [[NSData alloc] initWithBytes:" !\042#$%&'()*+,-./" length:16]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime2 = + [NSNumber numberWithUnsignedLongLong:2110002ULL]; + + [cluster keySetWriteWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"KeySet Write 3 TrustFirst Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestKeySetRead_11() { MTRBaseDevice * device = GetDevice("alpha"); @@ -135293,7 +135433,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteGroupKeysInvalid_10() + CHIP_ERROR TestWriteGroupKeysInvalid_12() { MTRBaseDevice * device = GetDevice("alpha"); @@ -135328,7 +135468,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteGroupKeysTooMany_11() + CHIP_ERROR TestWriteGroupKeysTooMany_13() { MTRBaseDevice * device = GetDevice("alpha"); @@ -135428,7 +135568,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteGroupKeysOnAlpha_12() + CHIP_ERROR TestWriteGroupKeysOnAlpha_14() { MTRBaseDevice * device = GetDevice("alpha"); @@ -135474,7 +135614,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteGroupKeysOnBeta_13() + CHIP_ERROR TestWriteGroupKeysOnBeta_15() { MTRBaseDevice * device = GetDevice("beta"); @@ -135520,7 +135660,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupKeysOnAlpha_14() + CHIP_ERROR TestReadGroupKeysOnAlpha_16() { MTRBaseDevice * device = GetDevice("alpha"); @@ -135582,7 +135722,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupKeysOnAlphaWithoutFabricFiltering_15() + CHIP_ERROR TestReadGroupKeysOnAlphaWithoutFabricFiltering_17() { MTRBaseDevice * device = GetDevice("alpha"); @@ -135676,7 +135816,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupKeysOnBeta_16() + CHIP_ERROR TestReadGroupKeysOnBeta_18() { MTRBaseDevice * device = GetDevice("beta"); @@ -135738,7 +135878,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupKeysOnBetaWithoutFabricFiltering_17() + CHIP_ERROR TestReadGroupKeysOnBetaWithoutFabricFiltering_19() { MTRBaseDevice * device = GetDevice("beta"); @@ -135832,7 +135972,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestAddGroup1_18() + CHIP_ERROR TestAddGroup1_20() { MTRBaseDevice * device = GetDevice("alpha"); @@ -135864,7 +136004,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestAddGroup2_19() + CHIP_ERROR TestAddGroup2_21() { MTRBaseDevice * device = GetDevice("alpha"); @@ -135896,7 +136036,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestAddGroup3_20() + CHIP_ERROR TestAddGroup3_22() { MTRBaseDevice * device = GetDevice("alpha"); @@ -135928,7 +136068,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestAddGroup4_21() + CHIP_ERROR TestAddGroup4_23() { MTRBaseDevice * device = GetDevice("alpha"); @@ -135960,7 +136100,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestAddGroup5_22() + CHIP_ERROR TestAddGroup5_24() { MTRBaseDevice * device = GetDevice("beta"); @@ -135992,7 +136132,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupTableFromAlpha_23() + CHIP_ERROR TestReadGroupTableFromAlpha_25() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136081,7 +136221,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupTableFromAlphaWithoutFabricFiltering_24() + CHIP_ERROR TestReadGroupTableFromAlphaWithoutFabricFiltering_26() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136185,7 +136325,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupTableFromBeta_25() + CHIP_ERROR TestReadGroupTableFromBeta_27() { MTRBaseDevice * device = GetDevice("beta"); @@ -136229,7 +136369,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupTableFromBetaWithoutFabricFiltering_26() + CHIP_ERROR TestReadGroupTableFromBetaWithoutFabricFiltering_28() { MTRBaseDevice * device = GetDevice("beta"); @@ -136333,7 +136473,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetRemove1_27() + CHIP_ERROR TestKeySetRemove1_29() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136356,7 +136496,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetReadRemoved_28() + CHIP_ERROR TestKeySetReadRemoved_30() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136383,7 +136523,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetReadNotRemoved_29() + CHIP_ERROR TestKeySetReadNotRemovedCacheAndSync_31() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136398,7 +136538,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { keySetReadWithParams:params completion:^( MTRGroupKeyManagementClusterKeySetReadResponseParams * _Nullable values, NSError * _Nullable err) { - NSLog(@"KeySet Read (not removed) Error: %@", err); + NSLog(@"KeySet Read (not removed) CacheAndSync Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -136434,7 +136574,58 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestRemoveGroup1_30() + CHIP_ERROR TestKeySetReadNotRemovedTrustFirst_32() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupKeyManagementClusterKeySetReadParams alloc] init]; + params.groupKeySetID = [NSNumber numberWithUnsignedShort:418U]; + [cluster + keySetReadWithParams:params + completion:^( + MTRGroupKeyManagementClusterKeySetReadResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"KeySet Read (not removed) TrustFirst Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.groupKeySet; + VerifyOrReturn(CheckValue("GroupKeySetID", + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) actualValue).groupKeySetID, 418U)); + VerifyOrReturn(CheckValue("GroupKeySecurityPolicy", + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) actualValue).groupKeySecurityPolicy, 0U)); + VerifyOrReturn(CheckValueNull( + "EpochKey0", ((MTRGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochKey0)); + VerifyOrReturn(CheckValueNonNull("EpochStartTime0", + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime0)); + VerifyOrReturn(CheckValue("EpochStartTime0", + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime0, 2110000ULL)); + VerifyOrReturn(CheckValueNull( + "EpochKey1", ((MTRGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochKey1)); + VerifyOrReturn(CheckValueNonNull("EpochStartTime1", + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime1)); + VerifyOrReturn(CheckValue("EpochStartTime1", + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime1, 2110001ULL)); + VerifyOrReturn(CheckValueNull( + "EpochKey2", ((MTRGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochKey2)); + VerifyOrReturn(CheckValueNonNull("EpochStartTime2", + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime2)); + VerifyOrReturn(CheckValue("EpochStartTime2", + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) actualValue).epochStartTime2, 2110002ULL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestRemoveGroup1_33() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136465,7 +136656,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupTable2_31() + CHIP_ERROR TestReadGroupTable2_34() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136539,7 +136730,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestRemoveAll_32() + CHIP_ERROR TestRemoveAll_35() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136557,7 +136748,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupTable3_33() + CHIP_ERROR TestReadGroupTable3_36() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136586,7 +136777,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetRemove2_34() + CHIP_ERROR TestKeySetRemove2_37() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136609,7 +136800,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetReadAlsoRemoved_35() + CHIP_ERROR TestKeySetReadAlsoRemoved_38() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136636,7 +136827,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetWrite1_36() + CHIP_ERROR TestKeySetWrite1_39() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136676,7 +136867,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetWrite2_37() + CHIP_ERROR TestKeySetWrite2CacheAndSync_40() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136706,7 +136897,47 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { [cluster keySetWriteWithParams:params completion:^(NSError * _Nullable err) { - NSLog(@"KeySet Write 2 Error: %@", err); + NSLog(@"KeySet Write 2 CacheAndSync Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestKeySetWrite2TrustFirst_41() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGroupKeyManagementClusterKeySetWriteParams alloc] init]; + params.groupKeySet = [[MTRGroupKeyManagementClusterGroupKeySetStruct alloc] init]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySetID = + [NSNumber numberWithUnsignedShort:418U]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).groupKeySecurityPolicy = + [NSNumber numberWithUnsignedChar:0U]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey0 = + [[NSData alloc] initWithBytes:"\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337" length:16]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime0 = + [NSNumber numberWithUnsignedLongLong:2110000ULL]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey1 = + [[NSData alloc] initWithBytes:"\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357" length:16]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime1 = + [NSNumber numberWithUnsignedLongLong:2110001ULL]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochKey2 = + [[NSData alloc] initWithBytes:"\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377" length:16]; + ((MTRGroupKeyManagementClusterGroupKeySetStruct *) params.groupKeySet).epochStartTime2 = + [NSNumber numberWithUnsignedLongLong:2110002ULL]; + + [cluster keySetWriteWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"KeySet Write 2 TrustFirst Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -136716,7 +136947,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestMapGroup1AndGroup2ToKeySet1AndGroup2ToKeySet2_38() + CHIP_ERROR TestMapGroup1AndGroup2ToKeySet1AndGroup2ToKeySet2_42() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136757,7 +136988,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestRemoveKeyset1_39() + CHIP_ERROR TestRemoveKeyset1_43() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136780,7 +137011,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThVerifiesGroupKeyMapEntriesForKeySet1HaveBeenRemoved_40() + CHIP_ERROR TestThVerifiesGroupKeyMapEntriesForKeySet1HaveBeenRemoved_44() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136818,7 +137049,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestRemoveKeyset2_41() + CHIP_ERROR TestRemoveKeyset2_45() { MTRBaseDevice * device = GetDevice("alpha"); @@ -136841,7 +137072,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThVerifiesGroupKeyMapEntriesForKeySet2HaveBeenRemoved_42() + CHIP_ERROR TestThVerifiesGroupKeyMapEntriesForKeySet2HaveBeenRemoved_46() { MTRBaseDevice * device = GetDevice("alpha");