diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index c1c182f18851b4..ad4a64161c30b7 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -1098,7 +1098,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"); @@ -1106,7 +1106,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; @@ -1859,14 +1859,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 385654f724f0c9..bae498e4ec1d35 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -643,7 +643,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.