From 292527f89cec6abf0767eff022c85bd11eacba6b Mon Sep 17 00:00:00 2001 From: Cecille Freeman Date: Wed, 30 Mar 2022 20:53:02 -0400 Subject: [PATCH] ICAC should be optional --- src/controller/CHIPDeviceController.cpp | 9 ++++----- src/controller/CHIPDeviceController.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index d208a99d00bbad..6d3005bd1ce0be 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -1078,7 +1078,7 @@ CHIP_ERROR DeviceCommissioner::ProcessCSR(DeviceProxy * proxy, const ByteSpan & } CHIP_ERROR DeviceCommissioner::SendOperationalCertificate(DeviceProxy * device, const ByteSpan & nocCertBuf, - const ByteSpan & icaCertBuf, const AesCcm128KeySpan ipk, + const Optional & icaCertBuf, const AesCcm128KeySpan ipk, const NodeId adminSubject) { MATTER_TRACE_EVENT_SCOPE("SendOperationalCertificate", "DeviceCommissioner"); @@ -1086,7 +1086,7 @@ CHIP_ERROR DeviceCommissioner::SendOperationalCertificate(DeviceProxy * device, OperationalCredentials::Commands::AddNOC::Type request; request.NOCValue = nocCertBuf; - request.ICACValue = chip::Optional(icaCertBuf); + request.ICACValue = icaCertBuf; request.IPKValue = ipk; request.caseAdminNode = adminSubject; request.adminVendorId = mVendorId; @@ -1837,14 +1837,13 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio } break; case CommissioningStage::kSendNOC: - if (!params.GetNoc().HasValue() || !params.GetIcac().HasValue() || !params.GetIpk().HasValue() || - !params.GetAdminSubject().HasValue()) + if (!params.GetNoc().HasValue() || !params.GetIpk().HasValue() || !params.GetAdminSubject().HasValue()) { ChipLogError(Controller, "AddNOC contents not specified"); CommissioningStageComplete(CHIP_ERROR_INVALID_ARGUMENT); return; } - SendOperationalCertificate(proxy, params.GetNoc().Value(), params.GetIcac().Value(), params.GetIpk().Value(), + SendOperationalCertificate(proxy, params.GetNoc().Value(), params.GetIcac(), params.GetIpk().Value(), params.GetAdminSubject().Value()); break; case CommissioningStage::kWiFiNetworkSetup: { diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index c2365bb122fd5e..aba2f473cfbf01 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -638,7 +638,7 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, /* This function sends the operational credentials to the device. The function does not hold a reference to the device object. */ - CHIP_ERROR SendOperationalCertificate(DeviceProxy * device, const ByteSpan & nocCertBuf, const ByteSpan & icaCertBuf, + CHIP_ERROR SendOperationalCertificate(DeviceProxy * device, const ByteSpan & nocCertBuf, const Optional & icaCertBuf, AesCcm128KeySpan ipk, NodeId adminSubject); /* This function sends the trusted root certificate to the device. The function does not hold a reference to the device object.