-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
manifest: Update Matter SDK revision to pull new crypto changes
In this commit added a mechanism that migrates all existing operational keys from mbedTLS-related settings storage to the PSA ITS secure storage. After the migration the entries in the settings storage will not be avaliable anymore. From NCS 2.6.0 the Matter supports Arm PSA Crypto API by default, and mbedTLS is deprecated. We should not use CommonServerInitParams to initialize PSA crypto and we should do it directly in the Application instead of Chip::Server. To do it we moved PSA init and declaration from the Chip::Server to the Nordic's Matter Init. Signed-off-by: Arkadiusz Balys <[email protected]>
- Loading branch information
1 parent
dbc2bc9
commit 71d287f
Showing
17 changed files
with
212 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
#include "migration_manager.h" | ||
|
||
#include <crypto/OperationalKeystore.h> | ||
#include <crypto/PersistentStorageOperationalKeystore.h> | ||
|
||
namespace Nrf::Matter | ||
{ | ||
namespace Migration | ||
{ | ||
#ifdef CONFIG_NCS_SAMPLE_MATTER_OPERATIONAL_KEYS_MIGRATION_TO_ITS | ||
CHIP_ERROR MoveOperationalKeysFromKvsToIts(chip::PersistentStorageDelegate *storage, | ||
chip::Crypto::OperationalKeystore *keystore) | ||
{ | ||
CHIP_ERROR err = CHIP_NO_ERROR; | ||
|
||
VerifyOrReturnError(keystore && storage, CHIP_ERROR_INVALID_ARGUMENT); | ||
|
||
/* Initialize the obsolete Operational Keystore*/ | ||
chip::PersistentStorageOperationalKeystore obsoleteKeystore; | ||
err = obsoleteKeystore.Init(storage); | ||
VerifyOrReturnError(err == CHIP_NO_ERROR, err); | ||
|
||
/* Migrate all obsolete Operational Keys to PSA ITS */ | ||
for (const chip::FabricInfo &fabric : chip::Server::GetInstance().GetFabricTable()) { | ||
err = keystore->MigrateOpKeypairForFabric(fabric.GetFabricIndex(), obsoleteKeystore); | ||
if (CHIP_NO_ERROR != err) { | ||
break; | ||
} | ||
} | ||
|
||
#ifdef CONFIG_NCS_SAMPLE_MATTER_FACTORY_RESET_ON_KEY_MIGRATION_FAILURE | ||
if (CHIP_NO_ERROR != err) { | ||
chip::Server::GetInstance().ScheduleFactoryReset(); | ||
/* Return a success to not block the Matter event Loop and allow to call scheduled factory | ||
* reset. */ | ||
err = CHIP_NO_ERROR; | ||
} | ||
#endif /* CONFIG_NCS_SAMPLE_MATTER_FACTORY_RESET_ON_KEY_MIGRATION_FAILURE */ | ||
|
||
return err; | ||
} | ||
#endif /* CONFIG_NCS_SAMPLE_MATTER_OPERATIONAL_KEYS_MIGRATION_TO_ITS */ | ||
} /* namespace Migration */ | ||
} /* namespace Nrf::Matter */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <app/server/Server.h> | ||
|
||
namespace Nrf::Matter | ||
{ | ||
namespace Migration | ||
{ | ||
#ifdef CONFIG_NCS_SAMPLE_MATTER_OPERATIONAL_KEYS_MIGRATION_TO_ITS | ||
/** | ||
* @brief Migrate all stored Operational Keys from the persistent storage (KVS) to secure PSA ITS. | ||
* | ||
* This function will schedule a factory reset automatically if the | ||
* CONFIG_NCS_SAMPLE_MATTER_FACTORY_RESET_ON_KEY_MIGRATION_FAILURE | ||
* Kconfig option is set to 'y'. In this case, the function returns CHIP_NO_ERROR to not block any further | ||
* operations until the scheduled factory reset is done. | ||
* | ||
* @note This function should be called just after Matter Server Init to avoid problems with further CASE | ||
* session re-establishments. | ||
* @param storage | ||
* @param keystore | ||
* @retval CHIP_NO_ERROR if all keys have been migrated properly to PSA ITS or if the error occurs, but | ||
* the CONFIG_NCS_SAMPLE_MATTER_FACTORY_RESET_ON_KEY_MIGRATION_FAILURE kconfig is set to 'y'. | ||
* @retval CHIP_ERROR_INVALID_ARGUMENT when keystore or storage are not defined. | ||
* @retval Other CHIP_ERROR codes related to internal Migration operations. | ||
*/ | ||
CHIP_ERROR MoveOperationalKeysFromKvsToIts(chip::PersistentStorageDelegate *storage, | ||
chip::Crypto::OperationalKeystore *keystore); | ||
#endif | ||
} /* namespace Migration */ | ||
} /* namespace Nrf::Matter */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.