Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CERT-TEST-FAILURE] TC-GRPKEY-2.1 key-set-write Commnad fails when EpochStartTime0 is set to 0 #28222

Closed
sumaky opened this issue Jul 24, 2023 · 2 comments · Fixed by #28379
Closed
Labels
bug Something isn't working cert blocker needs triage spec Mismatch between spec and implementation
Milestone

Comments

@sumaky
Copy link

sumaky commented Jul 24, 2023

Reproduction steps

./chip-tool groupkeymanagement key-set-write '{"groupKeySetID": "0x01a3","groupKeySecurityPolicy": 0, "epochKey0":"d0d1d2d3d4d5d6d7d8d9dadbdcdddedf", "epochStartTime0": 1,"epochKey1":"d1d1d2d3d4d5d6d7d8d9dadbdcdddedf", "epochStartTime1": 18446744073709551614,"epochKey2":"d2d1d2d3d4d5d6d7d8d9dadbdcdddedf", "epochStartTime2": 18446744073709551615 }' 1 0

the above command gives INVALID_COMMAND when epochStartTime0 is set to 0
the above command works well when we set epochSatrtime0 as 1

./chip-tool groupkeymanagement key-set-write '{"groupKeySetID": "0x01a3","groupKeySecurityPolicy": 0, "epochKey0":"00000000000000000000000000000001", "epochStartTime0": 0,"epochKey1":"00000000000000000000000000000002", "epochStartTime1": 222,"epochKey2":"00000000000000000000000000000003", "epochStartTime2": 333 }' 1 0
[1690207088.752479][5917:5917] CHIP:DL: ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_kvs
[1690207088.752613][5917:5917] CHIP:DL: ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_factory.ini
[1690207088.752630][5917:5917] CHIP:DL: ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_config.ini
[1690207088.752641][5917:5917] CHIP:DL: ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_counters.ini
[1690207088.752699][5917:5917] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-NfOV5C)
[1690207088.752789][5917:5917] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini)
[1690207088.752794][5917:5917] CHIP:DL: NVS set: chip-counters/reboot-count = 10 (0xA)
[1690207088.946237][5917:5917] CHIP:DL: Got Ethernet interface: enp3s0
[1690207088.946791][5917:5917] CHIP:DL: Found the primary Ethernet interface:enp3s0
[1690207088.947379][5917:5917] CHIP:DL: Got WiFi interface: wlp0s20f3
[1690207088.948935][5917:5917] CHIP:DL: Found the primary WiFi interface:wlp0s20f3
[1690207088.949028][5917:5917] CHIP:IN: UDP::Init bind&listen port=0
[1690207088.949066][5917:5917] CHIP:IN: UDP::Init bound to port=50602
[1690207088.949080][5917:5917] CHIP:IN: BLEBase::Init - setting/overriding transport
[1690207088.949084][5917:5917] CHIP:IN: TransportMgr initialized
[1690207088.949104][5917:5917] CHIP:FP: Initializing FabricTable from persistent storage
[1690207088.949228][5917:5917] CHIP:TS: Last Known Good Time: 2023-07-19T13:34:06
[1690207088.949553][5917:5917] CHIP:FP: Fabric index 0x1 was retrieved from storage. Compressed FabricId 0x60DB3AB80160D5A8, FabricId 0x0000000000000001, NodeId 0x000000000001B669, VendorId 0xFFF1
[1690207088.954150][5917:5917] CHIP:ZCL: Using ZAP configuration...
[1690207088.957443][5917:5917] CHIP:DL: Avahi client registered
[1690207088.957512][5917:5917] CHIP:CTL: System State Initialized...
[1690207088.957567][5917:5917] CHIP:CTL: Stopping commissioning discovery over DNS-SD
[1690207088.957599][5917:5917] CHIP:CTL: Setting attestation nonce to random value
[1690207088.957612][5917:5917] CHIP:CTL: Setting CSR nonce to random value
[1690207088.957637][5917:5917] CHIP:IN: UDP::Init bind&listen port=5550
[1690207088.957672][5917:5917] CHIP:IN: UDP::Init bound to port=5550
[1690207088.957679][5917:5917] CHIP:IN: TransportMgr initialized
[1690207088.957863][5917:5920] CHIP:DL: CHIP task running
[1690207088.958005][5917:5920] CHIP:DL: HandlePlatformSpecificBLEEvent 32786
[1690207088.958174][5917:5920] CHIP:CTL: Stopping commissioning discovery over DNS-SD
[1690207088.958194][5917:5920] CHIP:CTL: Setting attestation nonce to random value
[1690207088.958225][5917:5920] CHIP:CTL: Setting CSR nonce to random value
[1690207088.960109][5917:5920] CHIP:CTL: Generating NOC
[1690207088.960665][5917:5920] CHIP:FP: Validating NOC chain
[1690207088.961718][5917:5920] CHIP:FP: NOC chain validation successful
[1690207088.961809][5917:5920] CHIP:FP: Updated fabric at index: 0x1, Node ID: 0x000000000001B669
[1690207088.961820][5917:5920] CHIP:TS: Last Known Good Time: 2023-07-19T13:34:06
[1690207088.961828][5917:5920] CHIP:TS: New proposed Last Known Good Time: 2021-01-01T00:00:00
[1690207088.961834][5917:5920] CHIP:TS: Retaining current Last Known Good Time
[1690207088.963469][5917:5920] CHIP:FP: Metadata for Fabric 0x1 persisted to storage.
[1690207088.964018][5917:5920] CHIP:TS: Committing Last Known Good Time to storage: 2023-07-19T13:34:06
[1690207088.964347][5917:5920] CHIP:CTL: Joined the fabric at index 1. Fabric ID is 0x0000000000000001 (Compressed Fabric ID: 60DB3AB80160D5A8)
[1690207088.964352][5917:5920] CHIP:IN: UDP::Init bind&listen port=5550
[1690207088.964362][5917:5920] CHIP:IN: UDP::Init bound to port=5550
[1690207088.964364][5917:5920] CHIP:IN: TransportMgr initialized
[1690207088.965625][5917:5920] CHIP:TOO: Sending command to node 0x1
[1690207088.965693][5917:5920] CHIP:CSM: FindOrEstablishSession: PeerId = [1:0000000000000001]
[1690207088.965696][5917:5920] CHIP:CSM: FindOrEstablishSession: No existing OperationalSessionSetup instance found
[1690207088.965702][5917:5920] CHIP:DIS: OperationalSessionSetup[1:0000000000000001]: State change 1 --> 2
[1690207088.965706][5917:5920] CHIP:DIS: Resolving 60DB3AB80160D5A8:0000000000000001 ...
[1690207088.966006][5917:5920] CHIP:DL: Avahi resolve found
[1690207088.966022][5917:5920] CHIP:DIS: Node ID resolved for 60DB3AB80160D5A8:0000000000000001
[1690207088.966024][5917:5920] CHIP:DIS: Hostname: B44506D8EC8C0000
[1690207088.966026][5917:5920] CHIP:DIS: IP Address #1: fe80::c653:7025:be8b:ae49
[1690207088.966027][5917:5920] CHIP:DIS: Port: 5540
[1690207088.966028][5917:5920] CHIP:DIS: Mrp Interval idle: not present
[1690207088.966030][5917:5920] CHIP:DIS: Mrp Interval active: not present
[1690207088.966031][5917:5920] CHIP:DIS: TCP Supported: 1
[1690207088.966057][5917:5920] CHIP:DIS: UDP:[fe80::c653:7025:be8b:ae49%wlp0s20f3]:5540: new best score: 3
[1690207088.966071][5917:5920] CHIP:DIS: Checking node lookup status after 1 ms
[1690207088.966072][5917:5920] CHIP:DIS: Keeping DNSSD lookup active
[1690207089.165615][5917:5920] CHIP:DIS: Checking node lookup status after 200 ms
[1690207089.165721][5917:5920] CHIP:DIS: OperationalSessionSetup[1:0000000000000001]: Updating device address to UDP:[fe80::c653:7025:be8b:ae49%wlp0s20f3]:5540 while in state 2
[1690207089.165733][5917:5920] CHIP:DIS: OperationalSessionSetup[1:0000000000000001]: State change 2 --> 3
[1690207089.165832][5917:5920] CHIP:IN: SecureSession[0x7f13b4021c50]: Allocated Type:2 LSID:27750
[1690207089.165851][5917:5920] CHIP:SC: Initiating session on local FabricIndex 1 from 0x000000000001B669 -> 0x0000000000000001
[1690207089.166372][5917:5920] CHIP:EM: <<< [E:40378i S:0 M:10075745] (U) Msg TX to 0:0000000000000000 [0000] --- Type 0000:30 (SecureChannel:CASE_Sigma1)
[1690207089.166435][5917:5920] CHIP:IN: (U) Sending msg 10075745 to IP address 'UDP:[fe80::c653:7025:be8b:ae49%wlp0s20f3]:5540'
[1690207089.166546][5917:5920] CHIP:SC: Sent Sigma1 msg
[1690207089.166557][5917:5920] CHIP:DIS: OperationalSessionSetup[1:0000000000000001]: State change 3 --> 4
[1690207089.168062][5917:5920] CHIP:EM: >>> [E:40378i S:0 M:7639382 (Ack:10075745)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:31 (SecureChannel:CASE_Sigma2)
[1690207089.168080][5917:5920] CHIP:EM: Found matching exchange: 40378i, Delegate: 0x7f13b4024668
[1690207089.168095][5917:5920] CHIP:EM: Rxd Ack; Removing MessageCounter:10075745 from Retrans Table on exchange 40378i
[1690207089.168117][5917:5920] CHIP:SC: Received Sigma2 msg
[1690207089.168135][5917:5920] CHIP:SC: Peer assigned session session ID 19441
[1690207089.170163][5917:5920] CHIP:SC: Sending Sigma3
[1690207089.170423][5917:5920] CHIP:EM: <<< [E:40378i S:0 M:10075746 (Ack:7639382)] (U) Msg TX to 0:0000000000000000 [0000] --- Type 0000:32 (SecureChannel:CASE_Sigma3)
[1690207089.170475][5917:5920] CHIP:IN: (U) Sending msg 10075746 to IP address 'UDP:[fe80::c653:7025:be8b:ae49%wlp0s20f3]:5540'
[1690207089.170530][5917:5920] CHIP:SC: Sent Sigma3 msg
[1690207089.177234][5917:5920] CHIP:EM: >>> [E:40378i S:0 M:7639383 (Ack:10075746)] (U) Msg RX from 0:0000000000000000 [0000] --- Type 0000:40 (SecureChannel:StatusReport)
[1690207089.177260][5917:5920] CHIP:EM: Found matching exchange: 40378i, Delegate: 0x7f13b4024668
[1690207089.177278][5917:5920] CHIP:EM: Rxd Ack; Removing MessageCounter:10075746 from Retrans Table on exchange 40378i
[1690207089.177300][5917:5920] CHIP:SC: Success status report received. Session was established
[1690207089.178315][5917:5920] CHIP:SC: SecureSession[0x7f13b4021c50, LSID:27750]: State change 'kEstablishing' --> 'kActive'
[1690207089.178329][5917:5920] CHIP:IN: SecureSession[0x7f13b4021c50]: Activated - Type:2 LSID:27750
[1690207089.178334][5917:5920] CHIP:IN: New secure session activated for device <0000000000000001, 1>, LSID:27750 PSID:19441!
[1690207089.178343][5917:5920] CHIP:DIS: OperationalSessionSetup[1:0000000000000001]: State change 4 --> 5
[1690207089.178372][5917:5920] CHIP:TOO: Sending cluster (0x0000003F) command (0x00000000) on endpoint 0
[1690207089.178395][5917:5920] CHIP:DMG: ICR moving to [AddingComm]
[1690207089.178432][5917:5920] CHIP:DMG: ICR moving to [AddedComma]
[1690207089.178482][5917:5920] CHIP:EM: <<< [E:40379i S:27750 M:65133637] (S) Msg TX to 1:0000000000000001 [D5A8] --- Type 0001:08 (IM:InvokeCommandRequest)
[1690207089.178497][5917:5920] CHIP:IN: (S) Sending msg 65133637 on secure session with LSID: 27750
[1690207089.178557][5917:5920] CHIP:DMG: ICR moving to [CommandSen]
[1690207089.178590][5917:5920] CHIP:EM: <<< [E:40378i S:0 M:10075747 (Ack:7639383)] (U) Msg TX to 0:0000000000000000 [0000] --- Type 0000:10 (SecureChannel:StandaloneAck)
[1690207089.178635][5917:5920] CHIP:IN: (U) Sending msg 10075747 to IP address 'UDP:[fe80::c653:7025:be8b:ae49%wlp0s20f3]:5540'
[1690207089.178676][5917:5920] CHIP:EM: Flushed pending ack for MessageCounter:7639383 on exchange 40378i
[1690207089.179416][5917:5920] CHIP:EM: >>> [E:40379i S:27750 M:205396619 (Ack:65133637)] (S) Msg RX from 1:0000000000000001 [D5A8] --- Type 0001:09 (IM:InvokeCommandResponse)
[1690207089.179434][5917:5920] CHIP:EM: Found matching exchange: 40379i, Delegate: 0x7f13b4020fb8
[1690207089.179452][5917:5920] CHIP:EM: Rxd Ack; Removing MessageCounter:65133637 from Retrans Table on exchange 40379i
[1690207089.179469][5917:5920] CHIP:DMG: ICR moving to [ResponseRe]
[1690207089.179500][5917:5920] CHIP:DMG: InvokeResponseMessage =
[1690207089.179511][5917:5920] CHIP:DMG: {
[1690207089.179519][5917:5920] CHIP:DMG: suppressResponse = false,
[1690207089.179526][5917:5920] CHIP:DMG: InvokeResponseIBs =
[1690207089.179539][5917:5920] CHIP:DMG: [
[1690207089.179546][5917:5920] CHIP:DMG: InvokeResponseIB =
[1690207089.179558][5917:5920] CHIP:DMG: {
[1690207089.179565][5917:5920] CHIP:DMG: CommandStatusIB =
[1690207089.179574][5917:5920] CHIP:DMG: {
[1690207089.179582][5917:5920] CHIP:DMG: CommandPathIB =
[1690207089.179590][5917:5920] CHIP:DMG: {
[1690207089.179598][5917:5920] CHIP:DMG: EndpointId = 0x0,
[1690207089.179607][5917:5920] CHIP:DMG: ClusterId = 0x3f,
[1690207089.179615][5917:5920] CHIP:DMG: CommandId = 0x0,
[1690207089.179622][5917:5920] CHIP:DMG: },
[1690207089.179634][5917:5920] CHIP:DMG:
[1690207089.179641][5917:5920] CHIP:DMG: StatusIB =
[1690207089.179650][5917:5920] CHIP:DMG: {
[1690207089.179658][5917:5920] CHIP:DMG: status = 0x85 (INVALID_COMMAND),
[1690207089.179666][5917:5920] CHIP:DMG: },
[1690207089.179674][5917:5920] CHIP:DMG:
[1690207089.179681][5917:5920] CHIP:DMG: },
[1690207089.179691][5917:5920] CHIP:DMG:
[1690207089.179697][5917:5920] CHIP:DMG: },
[1690207089.179708][5917:5920] CHIP:DMG:
[1690207089.179714][5917:5920] CHIP:DMG: ],
[1690207089.179726][5917:5920] CHIP:DMG:
[1690207089.179733][5917:5920] CHIP:DMG: InteractionModelRevision = 1
[1690207089.179739][5917:5920] CHIP:DMG: },
[1690207089.179772][5917:5920] CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_003F Command=0x0000_0000 Status=0x85
[1690207089.179786][5917:5920] CHIP:TOO: Error: IM Error 0x00000585: General error: 0x85 (INVALID_COMMAND)

Bug prevalence

NA

GitHub hash of the SDK that was being used

NA

Platform

other

Platform Version(s)

NA

Anything else?

No response

@sumaky sumaky added bug Something isn't working needs triage labels Jul 24, 2023
@tcarmelveilleux
Copy link
Contributor

This is a real SDK bug where 1.0/1.1 does not respect spec, and disallows value 0

Spec issue: https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/7342

@cjandhyala cjandhyala added this to the 1.2 milestone Jul 24, 2023
@bzbarsky-apple bzbarsky-apple added the spec Mismatch between spec and implementation label Jul 24, 2023
@sumaky sumaky changed the title [BUG] TC-GRPKEY-2.1 key-set-write Commnad fails when EpochStartTime0 is set to 0 [CERT-TEST-FAILURE] TC-GRPKEY-2.1 key-set-write Commnad fails when EpochStartTime0 is set to 0 Jul 25, 2023
@tcarmelveilleux
Copy link
Contributor

Not a TE2 blocker

tcarmelveilleux pushed a commit to tcarmelveilleux/connectedhomeip that referenced this issue Jul 28, 2023
Problem:
 - GroupKeyManagement cluster did not enforce length checks on
   EpochKey0/1/2
 - Some corner cases of checks were not covered.
 - Spec fixed in https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/7342
 - Fixes project-chip#28222

This PR:
 - Adds all the missing checks that spec updates imply
 - Adds tests for each of the individual checks
 - Adds improved logging for failures

Testing done:
 - New integration tests added
 - Integration tests pass
@mergify mergify bot closed this as completed in #28379 Jul 31, 2023
mergify bot pushed a commit that referenced this issue Jul 31, 2023
* Add missing validity checks to GroupKeyManagement cluster

Problem:
 - GroupKeyManagement cluster did not enforce length checks on
   EpochKey0/1/2
 - Some corner cases of checks were not covered.
 - Spec fixed in CHIP-Specifications/connectedhomeip-spec#7342
 - Fixes #28222

This PR:
 - Adds all the missing checks that spec updates imply
 - Adds tests for each of the individual checks
 - Adds improved logging for failures

Testing done:
 - New integration tests added
 - Integration tests pass

* Restyled by clang-format

* Restyled by prettier-yaml

* Add revision 2

* Fix revision 2 setting

* Address comments from @bzbarsky-apple

* Fix unit test

* Restyled by clang-format

* ZAP regen

---------

Co-authored-by: tennessee.carmelveilleux@gmail.com <tennessee@google.com>
Co-authored-by: Restyled.io <commits@restyled.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cert blocker needs triage spec Mismatch between spec and implementation
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants