From 591b3863b7de5e8f05ca774b0fd63cc8a8733ef3 Mon Sep 17 00:00:00 2001 From: Sharad Binjola <31142146+sharadb-amazon@users.noreply.github.com> Date: Wed, 24 Aug 2022 08:48:43 -0700 Subject: [PATCH 01/18] Darwin: Allow partial validation of DAC and CD (for external cloud or custom app based validation) (#22115) --- src/darwin/Framework/CHIP/MTRDeviceController.h | 4 ++++ src/darwin/Framework/CHIP/MTRDeviceController.mm | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.h b/src/darwin/Framework/CHIP/MTRDeviceController.h index faca45ddde863b..6deca1706934ca 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController.h @@ -124,6 +124,10 @@ typedef void (^MTRDeviceConnectionCallback)(MTRBaseDevice * _Nullable device, NS * Sets this MTRDeviceController to use the given issuer for issuing operational certs. By default, the MTRDeviceController uses an * internal issuer. * + * When a nocChainIssuer is set, the device commissioner will delegate verification to the chip::Credentials::PartialDACVerifier so + * that DAC chain and CD validation can be performed by custom code triggered by MTRNOCChainIssuer.onNOCChainGenerationNeeded(). + * Otherwise, the device commissioner uses the chip::Credentials::DefaultDACVerifier + * * @param[in] nocChainIssuer the NOC Chain issuer to use for issuer operational certs * * @param[in] queue The queue on which the callbacks will be delivered diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index b170771f77ad0b..438ac2409c3ac5 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -77,6 +78,7 @@ @interface MTRDeviceController () @property (atomic, readonly) dispatch_queue_t chipWorkQueue; @property (readonly) chip::Controller::DeviceCommissioner * cppCommissioner; +@property (readonly) chip::Credentials::PartialDACVerifier * partialDACVerifier; @property (readonly) MTRDevicePairingDelegateBridge * pairingDelegateBridge; @property (readonly) MTROperationalCredentialsDelegate * operationalCredentialsDelegate; @property (readonly) MTRP256KeypairBridge signingKeypairBridge; @@ -664,7 +666,12 @@ - (void)setNocChainIssuer:(id)nocChainIssuer queue:(dispatch_ dispatch_sync(_chipWorkQueue, ^{ VerifyOrReturn([self checkIsRunning]); - self->_operationalCredentialsDelegate->SetNocChainIssuer(nocChainIssuer, queue); + if (nocChainIssuer != nil) { + self->_operationalCredentialsDelegate->SetNocChainIssuer(nocChainIssuer, queue); + self->_cppCommissioner->SetDeviceAttestationVerifier(_partialDACVerifier); + } else { + self->_cppCommissioner->SetDeviceAttestationVerifier(chip::Credentials::GetDeviceAttestationVerifier()); + } }); } From 83e1bbf9539adb5804142b51633033df274f8711 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Wed, 24 Aug 2022 10:48:32 -0700 Subject: [PATCH 02/18] Include missing Descriptor cluster in Secondary Network Commissioning Device Type (#22105) --- .../zap-templates/zcl/data-model/chip/matter-devices.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml index 210e6a60d91362..582fd4ee829c5d 100644 --- a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml +++ b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml @@ -2043,6 +2043,12 @@ limitations under the License. 0xF002 + + DEVICE_TYPE_LIST + SERVER_LIST + CLIENT_LIST + PARTS_LIST + From b4776ad0713aac4fc54eea493ed9a6229339fb3c Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Thu, 25 Aug 2022 04:29:18 +0900 Subject: [PATCH 03/18] Remove Android updateDevice API (#22093) --- .../clusterclient/AddressUpdateFragment.kt | 17 +---------------- .../clusterclient/SensorClientFragment.kt | 13 ------------- .../main/res/layout/address_update_fragment.xml | 14 -------------- .../devicecontroller/ChipDeviceController.java | 6 ------ 4 files changed, 1 insertion(+), 49 deletions(-) diff --git a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt index 1bb841b81965b3..217cbc00737721 100644 --- a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt +++ b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt @@ -13,7 +13,6 @@ import com.google.chip.chiptool.R import com.google.chip.chiptool.util.DeviceIdUtil import kotlinx.android.synthetic.main.address_update_fragment.deviceIdEd import kotlinx.android.synthetic.main.address_update_fragment.fabricIdEd -import kotlinx.android.synthetic.main.address_update_fragment.view.updateAddressBtn /** Fragment for updating the address of a device given its fabric and node ID. */ class AddressUpdateFragment: Fragment() { @@ -28,9 +27,7 @@ class AddressUpdateFragment: Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View { - return inflater.inflate(R.layout.address_update_fragment, container, false).apply { - updateAddressBtn.setOnClickListener { updateAddressClick() } - } + return inflater.inflate(R.layout.address_update_fragment, container, false).apply { } } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { @@ -40,16 +37,4 @@ class AddressUpdateFragment: Fragment() { fabricIdEd.setText(compressedFabricId.toULong().toString(16).padStart(16, '0')) deviceIdEd.setText(DeviceIdUtil.getLastDeviceId(requireContext()).toString()) } - - private fun updateAddressClick() { - try { - deviceController.updateDevice( - fabricIdEd.text.toString().toULong(16).toLong(), - deviceIdEd.text.toString().toULong().toLong() - ) - Toast.makeText(requireContext(), "Address update started", Toast.LENGTH_SHORT).show() - } catch (ex: Exception) { - Toast.makeText(requireContext(), "Address update failed: $ex", Toast.LENGTH_SHORT).show() - } - } } \ No newline at end of file diff --git a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt index 64f35095652732..587eb85020651c 100644 --- a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt +++ b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt @@ -66,7 +66,6 @@ class SensorClientFragment : Fragment() { ChipClient.getDeviceController(requireContext()).setCompletionListener(null) deviceIdEd.setOnEditorActionListener { textView, actionId, _ -> if (actionId == EditorInfo.IME_ACTION_DONE) { - updateAddress(textView.text.toString()) resetSensorGraph() // reset the graph on device change } actionId == EditorInfo.IME_ACTION_DONE @@ -116,7 +115,6 @@ class SensorClientFragment : Fragment() { override fun onStart() { super.onStart() deviceIdEd.setText(DeviceIdUtil.getLastDeviceId(requireContext()).toString()) - updateAddress(deviceIdEd.text.toString()) } override fun onStop() { @@ -124,17 +122,6 @@ class SensorClientFragment : Fragment() { super.onStop() } - private fun updateAddress(deviceId: String) { - try { - ChipClient.getDeviceController(requireContext()).updateDevice( - /* fabric ID */ 5544332211, - deviceId.toULong().toLong() - ) - } catch (ex: Exception) { - showMessage(R.string.update_device_address_failure, ex.toString()) - } - } - private fun resetSensorGraph() { watchSensorBtn.isChecked = false sensorGraph.visibility = View.INVISIBLE diff --git a/src/android/CHIPTool/app/src/main/res/layout/address_update_fragment.xml b/src/android/CHIPTool/app/src/main/res/layout/address_update_fragment.xml index c76cc76fc7b85e..3a401297e326aa 100644 --- a/src/android/CHIPTool/app/src/main/res/layout/address_update_fragment.xml +++ b/src/android/CHIPTool/app/src/main/res/layout/address_update_fragment.xml @@ -32,18 +32,4 @@ android:layout_height="wrap_content" app:barrierDirection="bottom" app:constraint_referenced_ids="fabricIdEd,deviceIdEd" /> - -