-
Notifications
You must be signed in to change notification settings - Fork 60
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
Clear ITS keys on factory reset #436
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -42,7 +42,11 @@ | |||||
|
||||||
#ifdef CONFIG_NET_L2_OPENTHREAD | ||||||
#include <platform/ThreadStackManager.h> | ||||||
#endif | ||||||
#endif | ||||||
|
||||||
#ifdef CONFIG_CHIP_FACTORY_RESET_ERASE_PSA_ITS | ||||||
#include <crypto/CHIPCryptoPALPSA.h> | ||||||
#endif | ||||||
|
||||||
namespace chip { | ||||||
namespace DeviceLayer { | ||||||
|
@@ -210,6 +214,22 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) | |||||
ConnectivityMgr().ErasePersistentInfo(); | ||||||
#endif | ||||||
|
||||||
#ifdef CONFIG_CHIP_FACTORY_RESET_ERASE_PSA_ITS | ||||||
// Ensure that all persistent PSA crypto materials are removed. | ||||||
for (uint32_t keyID = static_cast<uint32_t>(chip::Crypto::KeyIdBase::Minimum); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
etc. to not cast via Though now that I think about it, this will invoke |
||||||
keyID <= static_cast<uint32_t>(chip::Crypto::KeyIdBase::Maximum); keyID++) | ||||||
{ | ||||||
#ifdef CONFIG_CHIP_CRYPTO_PSA_MIGRATE_DAC_PRIV_KEY | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would run this |
||||||
// Prevent from removing DAC Private Key | ||||||
if (keyID == static_cast<uint32_t>(chip::Crypto::KeyIdBase::DACPrivKey)) | ||||||
{ | ||||||
continue; | ||||||
} | ||||||
#endif | ||||||
psa_destroy_key(static_cast<psa_key_id_t>(keyID)); | ||||||
} | ||||||
#endif | ||||||
|
||||||
PlatformMgr().Shutdown(); | ||||||
} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know the full background of this change, but do we want to make it configurable? It seems like we may have problem if these data will not be removed, so maybe we should just do it always? Also shouldn't we enable it for our platform or set default to y for everyone?