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

Implement shadow fail-safe data in FabricTable #19819

Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
54b18f9
Implement shadow fail-safe data in FabricTable
tcarmelveilleux Jun 21, 2022
9ae8c22
Restyled by clang-format
restyled-commits Jun 21, 2022
35c7eeb
Merge remote-tracking branch 'upstream/master' into update-fabrictabl…
tcarmelveilleux Jun 21, 2022
d37dccd
Fixes after merging master
tcarmelveilleux Jun 21, 2022
beff07e
Rename callback of FabricTable::Delegate
tcarmelveilleux Jun 21, 2022
003a59a
Rekick restyle
tcarmelveilleux Jun 21, 2022
a56451d
restyle
tcarmelveilleux Jun 21, 2022
98a7f51
Align last known good time commit / revert to shadow fail-safe approach
msandstedt Jun 21, 2022
6e6122e
Fix CI
tcarmelveilleux Jun 21, 2022
50c67f7
Merge pull request #9 from msandstedt/update-fabrictable-new-opcert-s…
tcarmelveilleux Jun 21, 2022
59d5e58
Fix TV app
tcarmelveilleux Jun 22, 2022
5b4874e
Merge remote-tracking branch 'origin/update-fabrictable-new-opcert-st…
tcarmelveilleux Jun 22, 2022
fa5157c
Reduce flash usage on K32W0 by disabling detail (verbose) logs
tcarmelveilleux Jun 22, 2022
b3a6461
Merge remote-tracking branch 'upstream/master' into update-fabrictabl…
tcarmelveilleux Jun 22, 2022
e94260b
Merge remote-tracking branch 'upstream/master' into update-fabrictabl…
tcarmelveilleux Jun 22, 2022
db03f18
Disable progress logging in TI platform lock example to save flash
tcarmelveilleux Jun 22, 2022
4835323
Disable progress logging in TI platform shell example to save flash
tcarmelveilleux Jun 22, 2022
8ea7610
Reduce stack usage of TestEventLogging
tcarmelveilleux Jun 22, 2022
45550c6
Apply review comments from @msandstedt
tcarmelveilleux Jun 22, 2022
52699c4
Save stack for Nordic build
tcarmelveilleux Jun 22, 2022
e62391e
Save stack for Nordic build, some more
tcarmelveilleux Jun 22, 2022
56c610d
Added unit tests for all basic operations
tcarmelveilleux Jun 23, 2022
ef143c6
Merge remote-tracking branch 'upstream/master' into update-fabrictabl…
tcarmelveilleux Jun 23, 2022
626e738
Fix merge conflict
tcarmelveilleux Jun 23, 2022
ed6db09
Restyle
tcarmelveilleux Jun 23, 2022
6962ec1
Merge remote-tracking branch 'upstream/master' into update-fabrictabl…
tcarmelveilleux Jun 23, 2022
5d019c8
Change nrf connect stack limit up by 512 bytes for fake unit test com…
tcarmelveilleux Jun 23, 2022
3decd98
Revert "Save stack for Nordic build"
tcarmelveilleux Jun 23, 2022
33ef943
Revert "Save stack for Nordic build, some more"
tcarmelveilleux Jun 23, 2022
5dd808c
Fix UpdateLabel
tcarmelveilleux Jun 23, 2022
3eb3a16
Apply review comments, add ACL fabric removal
tcarmelveilleux Jun 23, 2022
84a871c
Apply review comments
tcarmelveilleux Jun 23, 2022
2dda34d
per bzbarsky, clear in-memory Last Known Good Time if revert fails
msandstedt Jun 23, 2022
c3ebba5
Merge pull request #10 from msandstedt/update-fabrictable-new-opcert-…
tcarmelveilleux Jun 23, 2022
efa0c5f
Apply fixes from @bzbarsky-apple
tcarmelveilleux Jun 23, 2022
f4d541b
Merge remote-tracking branch 'origin/update-fabrictable-new-opcert-st…
tcarmelveilleux Jun 23, 2022
684d8e8
Apply more review comments
tcarmelveilleux Jun 23, 2022
d619d56
Restyled
tcarmelveilleux Jun 23, 2022
225ab8f
Fix tests
tcarmelveilleux Jun 23, 2022
0e33917
Add unit test for iterator
tcarmelveilleux Jun 23, 2022
f09d11f
Iterator now works
tcarmelveilleux Jun 23, 2022
05cc156
Merge remote-tracking branch 'upstream/master' into update-fabrictabl…
tcarmelveilleux Jun 23, 2022
eea33f0
Fix semantic merge conflict
tcarmelveilleux Jun 23, 2022
2b17b3e
Restyled
tcarmelveilleux Jun 23, 2022
4935173
Merge remote-tracking branch 'upstream/master' into update-fabrictabl…
tcarmelveilleux Jun 23, 2022
cbbf425
Fix predicates for storage presence temporarily
tcarmelveilleux Jun 23, 2022
5691e4a
Fix Darwin build
bzbarsky-apple Jun 23, 2022
92d340e
Merge pull request #11 from bzbarsky-apple/testing
tcarmelveilleux Jun 23, 2022
29f01dd
Add missing docs, move methods to private that shouldn't be public
tcarmelveilleux Jun 24, 2022
c182cfe
Merge remote-tracking branch 'upstream/master' into update-fabrictabl…
tcarmelveilleux Jun 24, 2022
3efe420
Change stack warning temporarily to pass on nRFConnect
tcarmelveilleux Jun 24, 2022
50818c4
Make MatterControllerFactory use const FabricInfo
tcarmelveilleux Jun 24, 2022
9f0b34e
Restyle
tcarmelveilleux Jun 24, 2022
54376dd
Merge remote-tracking branch 'upstream/master' into update-fabrictabl…
tcarmelveilleux Jun 24, 2022
d8864e3
Fix semantic conflict on SessionManager
tcarmelveilleux Jun 24, 2022
096a76a
Fix an init ordering issue in TestSessionManager.cpp
tcarmelveilleux Jun 24, 2022
21ab76b
Fix SessionManager shutdown
tcarmelveilleux Jun 24, 2022
444cbd5
Restyled
tcarmelveilleux Jun 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions examples/chip-tool/commands/common/CHIPCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ CHIP_ERROR CHIPCommand::MaybeSetUpStack()

ReturnLogErrorOnFailure(mDefaultStorage.Init());
ReturnLogErrorOnFailure(mOperationalKeystore.Init(&mDefaultStorage));
ReturnLogErrorOnFailure(mOpCertStore.Init(&mDefaultStorage));

chip::Controller::FactoryInitParams factoryInitParams;

factoryInitParams.fabricIndependentStorage = &mDefaultStorage;
factoryInitParams.operationalKeystore = &mOperationalKeystore;
factoryInitParams.opCertStore = &mOpCertStore;

// Init group data provider that will be used for all group keys and IPKs for the
// chip-tool-configured fabrics. This is OK to do once since the fabric tables
Expand Down Expand Up @@ -126,23 +128,25 @@ CHIP_ERROR CHIPCommand::MaybeSetUpStack()
// Initialize Group Data, including IPK
for (auto it = mCommissioners.begin(); it != mCommissioners.end(); it++)
{
chip::FabricInfo * fabric = it->second->GetFabricInfo();
if ((nullptr != fabric) && (0 != it->first.compare(kIdentityNull)))
{
uint8_t compressed_fabric_id[sizeof(uint64_t)];
chip::MutableByteSpan compressed_fabric_id_span(compressed_fabric_id);
ReturnLogErrorOnFailure(fabric->GetCompressedId(compressed_fabric_id_span));
const chip::Controller::DeviceCommissioner * controller = it->second.get();

ReturnLogErrorOnFailure(
chip::GroupTesting::InitData(&mGroupDataProvider, fabric->GetFabricIndex(), compressed_fabric_id_span));
chip::FabricIndex fabricIndex = controller->GetFabricIndex();

uint8_t compressed_fabric_id[sizeof(uint64_t)];
chip::MutableByteSpan compressed_fabric_id_span(compressed_fabric_id);
CHIP_ERROR err = controller->GetCompressedFabricIdBytes(compressed_fabric_id_span);

if ((err == CHIP_NO_ERROR) && (0 != it->first.compare(kIdentityNull)))
tcarmelveilleux marked this conversation as resolved.
Show resolved Hide resolved
{
ReturnLogErrorOnFailure(chip::GroupTesting::InitData(&mGroupDataProvider, fabricIndex, compressed_fabric_id_span));

// Configure the default IPK for all fabrics used by CHIP-tool. The epoch
// key is the same, but the derived keys will be different for each fabric.
// This has to be done here after we know the Compressed Fabric ID of all
// chip-tool-managed fabrics
chip::ByteSpan defaultIpk = chip::GroupTesting::DefaultIpkValue::GetDefaultIpk();
ReturnLogErrorOnFailure(chip::Credentials::SetSingleIpkEpochKey(&mGroupDataProvider, fabric->GetFabricIndex(),
defaultIpk, compressed_fabric_id_span));
ReturnLogErrorOnFailure(
chip::Credentials::SetSingleIpkEpochKey(&mGroupDataProvider, fabricIndex, defaultIpk, compressed_fabric_id_span));
}
}

Expand Down
2 changes: 2 additions & 0 deletions examples/chip-tool/commands/common/CHIPCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <commands/common/CredentialIssuerCommands.h>
#include <commands/example/ExampleCredentialIssuerCommands.h>
#include <credentials/GroupDataProviderImpl.h>
#include <credentials/PersistentStorageOpCertStore.h>
#include <crypto/PersistentStorageOperationalKeystore.h>

#pragma once
Expand Down Expand Up @@ -121,6 +122,7 @@ class CHIPCommand : public Command
PersistentStorage mCommissionerStorage;
#endif // CONFIG_USE_LOCAL_STORAGE
chip::PersistentStorageOperationalKeystore mOperationalKeystore;
chip::Credentials::PersistentStorageOpCertStore mOpCertStore;

chip::Credentials::GroupDataProviderImpl mGroupDataProvider{ kMaxGroupsPerFabric, kMaxGroupKeysPerFabric };
CredentialIssuerCommands * mCredIssuerCmds;
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/group/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ class AddKeySet : public CHIPCommand
chip::Credentials::GroupDataProvider * groupDataProvider = chip::Credentials::GetGroupDataProvider();
uint8_t compressed_fabric_id[sizeof(uint64_t)];
chip::MutableByteSpan compressed_fabric_id_span(compressed_fabric_id);
ReturnLogErrorOnFailure(CurrentCommissioner().GetFabricInfo()->GetCompressedId(compressed_fabric_id_span));
ReturnLogErrorOnFailure(CurrentCommissioner().GetCompressedFabricIdBytes(compressed_fabric_id_span));

if ((keyPolicy != chip::Credentials::GroupDataProvider::SecurityPolicy::kCacheAndSync &&
keyPolicy != chip::Credentials::GroupDataProvider::SecurityPolicy::kTrustFirst) ||
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/cc13x2x7_26x2x7/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ lwip_debug = false
chip_enable_ota_requestor = true

# Disable CHIP Logging
#chip_progress_logging = false
chip_progress_logging = false
chip_detail_logging = false
chip_automation_logging = false

Expand Down
18 changes: 9 additions & 9 deletions examples/platform/linux/CommissionerMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,30 +171,30 @@ CHIP_ERROR InitCommissioner(uint16_t commissionerPort, uint16_t udcListenPort)
ReturnErrorOnFailure(factory.Init(factoryParams));
ReturnErrorOnFailure(factory.SetupCommissioner(params, gCommissioner));

chip::FabricInfo * fabricInfo = gCommissioner.GetFabricInfo();
VerifyOrReturnError(fabricInfo != nullptr, CHIP_ERROR_INTERNAL);
FabricIndex fabricIndex = gCommissioner.GetFabricIndex();
VerifyOrReturnError(fabricIndex != kUndefinedFabricIndex, CHIP_ERROR_INTERNAL);

uint8_t compressedFabricId[sizeof(uint64_t)] = { 0 };
MutableByteSpan compressedFabricIdSpan(compressedFabricId);
ReturnErrorOnFailure(fabricInfo->GetCompressedId(compressedFabricIdSpan));
ChipLogProgress(Support, "Setting up group data for Fabric Index %u with Compressed Fabric ID:",
static_cast<unsigned>(fabricInfo->GetFabricIndex()));
ReturnErrorOnFailure(gCommissioner.GetCompressedFabricIdBytes(compressedFabricIdSpan));
ChipLogProgress(Support,
"Setting up group data for Fabric Index %u with Compressed Fabric ID:", static_cast<unsigned>(fabricIndex));
ChipLogByteSpan(Support, compressedFabricIdSpan);

// TODO: Once ExampleOperationalCredentialsIssuer has support, set default IPK on it as well so
// that commissioned devices get the IPK set from real values rather than "test-only" internal hookups.
ByteSpan defaultIpk = chip::GroupTesting::DefaultIpkValue::GetDefaultIpk();
ReturnLogErrorOnFailure(chip::Credentials::SetSingleIpkEpochKey(&gGroupDataProvider, fabricInfo->GetFabricIndex(), defaultIpk,
compressedFabricIdSpan));
ReturnLogErrorOnFailure(
chip::Credentials::SetSingleIpkEpochKey(&gGroupDataProvider, fabricIndex, defaultIpk, compressedFabricIdSpan));

gCommissionerDiscoveryController.SetUserDirectedCommissioningServer(gCommissioner.GetUserDirectedCommissioningServer());
gCommissionerDiscoveryController.SetCommissionerCallback(&gCommissionerCallback);

// advertise operational since we are an admin
app::DnssdServer::Instance().AdvertiseOperational();

ChipLogProgress(Support, "InitCommissioner nodeId=0x" ChipLogFormatX64 " fabricIndex=%d",
ChipLogValueX64(gCommissioner.GetNodeId()), fabricInfo->GetFabricIndex());
ChipLogProgress(Support, "InitCommissioner nodeId=0x" ChipLogFormatX64 " fabricIndex=0x%u",
tcarmelveilleux marked this conversation as resolved.
Show resolved Hide resolved
ChipLogValueX64(gCommissioner.GetNodeId()), static_cast<unsigned>(fabricIndex));

return CHIP_NO_ERROR;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/shell/cc13x2x7_26x2x7/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ chip_enable_ota_requestor = false
chip_openthread_ftd = false

# Disable CHIP Logging
#chip_progress_logging = false
chip_progress_logging = false
chip_detail_logging = false
chip_automation_logging = false

Expand Down
Loading