From a604f8ea40d435959cce9ef6516e35fc1bd55d2d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 23 May 2023 12:04:24 -0400 Subject: [PATCH] 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 6f890fdd747777..ec2208e056f993 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 9474d98c22a5d3..4aedb61d7e28ee 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 f579be935c8b38..42e6ecb323af16 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -3616,6 +3616,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 9d04e5f754abf2..88a6cdcf05e1a1 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -580,9 +580,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 3050e1b2866d5d..483c1f2ea30cea 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -93080,7 +93080,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); @@ -93156,6 +93156,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; @@ -93176,19 +93182,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< @@ -93217,7 +93223,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 15: + case 17: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -93262,7 +93268,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 16: + case 18: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -93291,7 +93297,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 17: + case 19: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -93336,7 +93342,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; @@ -93345,7 +93351,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; @@ -93354,7 +93360,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; @@ -93363,7 +93369,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; @@ -93372,7 +93378,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; @@ -93381,7 +93387,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< @@ -93450,7 +93456,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 24: + case 26: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -93533,7 +93539,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 25: + case 27: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -93560,7 +93566,7 @@ class TestGroupKeyManagementClusterSuite : public TestCommand } } break; - case 26: + case 28: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { chip::app::DataModel::DecodableList< @@ -93643,13 +93649,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; @@ -93670,7 +93676,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; @@ -93679,7 +93706,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< @@ -93734,10 +93761,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< @@ -93750,25 +93777,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< @@ -93785,10 +93815,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< @@ -93895,7 +93925,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; @@ -93930,7 +93961,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; @@ -93962,8 +94030,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; @@ -93972,8 +94074,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; @@ -93991,8 +94093,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; @@ -94062,8 +94164,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; @@ -94093,8 +94195,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; @@ -94124,28 +94226,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; @@ -94154,8 +94256,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; @@ -94164,8 +94266,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; @@ -94174,8 +94276,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; @@ -94184,8 +94286,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; @@ -94194,28 +94296,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; @@ -94224,8 +94326,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; @@ -94234,8 +94336,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; @@ -94244,8 +94347,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; @@ -94254,13 +94368,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, @@ -94268,13 +94382,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; @@ -94283,8 +94397,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; @@ -94293,8 +94407,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; @@ -94328,8 +94442,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; @@ -94363,8 +94478,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; @@ -94390,8 +94541,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; @@ -94400,13 +94551,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; @@ -94415,8 +94566,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 39eb96909bb5de..7a8e4717a769af 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -142147,148 +142147,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; } @@ -142332,16 +142380,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)); @@ -142386,13 +142434,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)); @@ -142407,7 +142455,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)); @@ -142416,7 +142464,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)); @@ -142430,6 +142478,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. @@ -142443,7 +142503,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; @@ -142583,7 +142643,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetWrite2_7() + CHIP_ERROR TestKeySetWrite2CacheAndSync_7() { MTRBaseDevice * device = GetDevice("alpha"); @@ -142613,7 +142673,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)); @@ -142623,7 +142723,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetWrite3_8() + CHIP_ERROR TestKeySetWrite3CacheAndSync_9() { MTRBaseDevice * device = GetDevice("beta"); @@ -142653,7 +142753,47 @@ 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)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + 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)); @@ -142663,7 +142803,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetRead_9() + CHIP_ERROR TestKeySetRead_11() { MTRBaseDevice * device = GetDevice("alpha"); @@ -142714,7 +142854,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteGroupKeysInvalid_10() + CHIP_ERROR TestWriteGroupKeysInvalid_12() { MTRBaseDevice * device = GetDevice("alpha"); @@ -142749,7 +142889,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteGroupKeysTooMany_11() + CHIP_ERROR TestWriteGroupKeysTooMany_13() { MTRBaseDevice * device = GetDevice("alpha"); @@ -142849,7 +142989,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteGroupKeysOnAlpha_12() + CHIP_ERROR TestWriteGroupKeysOnAlpha_14() { MTRBaseDevice * device = GetDevice("alpha"); @@ -142895,7 +143035,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteGroupKeysOnBeta_13() + CHIP_ERROR TestWriteGroupKeysOnBeta_15() { MTRBaseDevice * device = GetDevice("beta"); @@ -142941,7 +143081,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupKeysOnAlpha_14() + CHIP_ERROR TestReadGroupKeysOnAlpha_16() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143003,7 +143143,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupKeysOnAlphaWithoutFabricFiltering_15() + CHIP_ERROR TestReadGroupKeysOnAlphaWithoutFabricFiltering_17() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143097,7 +143237,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupKeysOnBeta_16() + CHIP_ERROR TestReadGroupKeysOnBeta_18() { MTRBaseDevice * device = GetDevice("beta"); @@ -143159,7 +143299,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupKeysOnBetaWithoutFabricFiltering_17() + CHIP_ERROR TestReadGroupKeysOnBetaWithoutFabricFiltering_19() { MTRBaseDevice * device = GetDevice("beta"); @@ -143253,7 +143393,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestAddGroup1_18() + CHIP_ERROR TestAddGroup1_20() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143285,7 +143425,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestAddGroup2_19() + CHIP_ERROR TestAddGroup2_21() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143317,7 +143457,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestAddGroup3_20() + CHIP_ERROR TestAddGroup3_22() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143349,7 +143489,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestAddGroup4_21() + CHIP_ERROR TestAddGroup4_23() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143381,7 +143521,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestAddGroup5_22() + CHIP_ERROR TestAddGroup5_24() { MTRBaseDevice * device = GetDevice("beta"); @@ -143413,7 +143553,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupTableFromAlpha_23() + CHIP_ERROR TestReadGroupTableFromAlpha_25() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143502,7 +143642,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupTableFromAlphaWithoutFabricFiltering_24() + CHIP_ERROR TestReadGroupTableFromAlphaWithoutFabricFiltering_26() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143606,7 +143746,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupTableFromBeta_25() + CHIP_ERROR TestReadGroupTableFromBeta_27() { MTRBaseDevice * device = GetDevice("beta"); @@ -143650,7 +143790,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupTableFromBetaWithoutFabricFiltering_26() + CHIP_ERROR TestReadGroupTableFromBetaWithoutFabricFiltering_28() { MTRBaseDevice * device = GetDevice("beta"); @@ -143754,7 +143894,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetRemove1_27() + CHIP_ERROR TestKeySetRemove1_29() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143777,7 +143917,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetReadRemoved_28() + CHIP_ERROR TestKeySetReadRemoved_30() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143804,7 +143944,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetReadNotRemoved_29() + CHIP_ERROR TestKeySetReadNotRemovedCacheAndSync_31() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143819,7 +143959,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)); @@ -143855,7 +143995,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"); @@ -143886,7 +144077,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupTable2_31() + CHIP_ERROR TestReadGroupTable2_34() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143960,7 +144151,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestRemoveAll_32() + CHIP_ERROR TestRemoveAll_35() { MTRBaseDevice * device = GetDevice("alpha"); @@ -143978,7 +144169,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadGroupTable3_33() + CHIP_ERROR TestReadGroupTable3_36() { MTRBaseDevice * device = GetDevice("alpha"); @@ -144007,7 +144198,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetRemove2_34() + CHIP_ERROR TestKeySetRemove2_37() { MTRBaseDevice * device = GetDevice("alpha"); @@ -144030,7 +144221,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetReadAlsoRemoved_35() + CHIP_ERROR TestKeySetReadAlsoRemoved_38() { MTRBaseDevice * device = GetDevice("alpha"); @@ -144057,7 +144248,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetWrite1_36() + CHIP_ERROR TestKeySetWrite1_39() { MTRBaseDevice * device = GetDevice("alpha"); @@ -144097,7 +144288,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestKeySetWrite2_37() + CHIP_ERROR TestKeySetWrite2CacheAndSync_40() { MTRBaseDevice * device = GetDevice("alpha"); @@ -144127,7 +144318,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)); @@ -144137,7 +144368,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestMapGroup1AndGroup2ToKeySet1AndGroup2ToKeySet2_38() + CHIP_ERROR TestMapGroup1AndGroup2ToKeySet1AndGroup2ToKeySet2_42() { MTRBaseDevice * device = GetDevice("alpha"); @@ -144178,7 +144409,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestRemoveKeyset1_39() + CHIP_ERROR TestRemoveKeyset1_43() { MTRBaseDevice * device = GetDevice("alpha"); @@ -144201,7 +144432,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThVerifiesGroupKeyMapEntriesForKeySet1HaveBeenRemoved_40() + CHIP_ERROR TestThVerifiesGroupKeyMapEntriesForKeySet1HaveBeenRemoved_44() { MTRBaseDevice * device = GetDevice("alpha"); @@ -144239,7 +144470,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestRemoveKeyset2_41() + CHIP_ERROR TestRemoveKeyset2_45() { MTRBaseDevice * device = GetDevice("alpha"); @@ -144262,7 +144493,7 @@ class TestGroupKeyManagementCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestThVerifiesGroupKeyMapEntriesForKeySet2HaveBeenRemoved_42() + CHIP_ERROR TestThVerifiesGroupKeyMapEntriesForKeySet2HaveBeenRemoved_46() { MTRBaseDevice * device = GetDevice("alpha");