Skip to content

Commit

Permalink
ICAC should be optional (project-chip#16879)
Browse files Browse the repository at this point in the history
  • Loading branch information
cecille authored and chencheung committed Apr 6, 2022
1 parent a155e8f commit 2e349e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1098,15 +1098,15 @@ 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<ByteSpan> & icaCertBuf, const AesCcm128KeySpan ipk,
const NodeId adminSubject)
{
MATTER_TRACE_EVENT_SCOPE("SendOperationalCertificate", "DeviceCommissioner");
VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT);

OperationalCredentials::Commands::AddNOC::Type request;
request.NOCValue = nocCertBuf;
request.ICACValue = chip::Optional<ByteSpan>(icaCertBuf);
request.ICACValue = icaCertBuf;
request.IPKValue = ipk;
request.caseAdminNode = adminSubject;
request.adminVendorId = mVendorId;
Expand Down Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion src/controller/CHIPDeviceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<ByteSpan> & 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.
Expand Down

0 comments on commit 2e349e5

Please sign in to comment.