17
17
#include " AttestationKey.h"
18
18
#include " ProvisionStorage.h"
19
19
#include < credentials/examples/DeviceAttestationCredsExample.h>
20
- #include < em_msc.h>
21
20
#include < lib/support/BytesToHex.h>
22
21
#include < lib/support/CHIPMemString.h>
23
22
#include < lib/support/CodeUtils.h>
26
25
#include < nvm3_default.h>
27
26
#include < nvm3_hal_flash.h>
28
27
#include < platform/CHIPDeviceConfig.h>
28
+ #include < platform/silabs/MigrationManager.h>
29
29
#include < platform/silabs/SilabsConfig.h>
30
- #include < psa/crypto.h>
31
30
#include < silabs_creds.h>
32
31
#ifdef SLI_SI91X_MCU_INTERFACE
33
32
#include < sl_si91x_common_flash_intf.h>
33
+ #else
34
+ #include < em_msc.h>
35
+ #include < psa/crypto.h>
34
36
#endif
35
37
36
38
#ifdef SL_PROVISION_GENERATOR
37
39
extern void setNvm3End (uint32_t addr);
40
+ #elif !SL_MATTER_GN_BUILD
41
+ #include < sl_matter_provision_config.h>
38
42
#endif
39
43
40
44
extern uint8_t linker_nvm_end[];
@@ -535,7 +539,7 @@ CHIP_ERROR Storage::GetDeviceAttestationCert(MutableByteSpan & value)
535
539
return err;
536
540
}
537
541
538
- #ifdef SLI_SI91X_MCU_INTERFACE
542
+ #if defined( SLI_SI91X_MCU_INTERFACE) && defined(SL_MBEDTLS_USE_TINYCRYPT)
539
543
CHIP_ERROR Storage::SetDeviceAttestationKey (const ByteSpan & value)
540
544
{
541
545
return SilabsConfig::WriteConfigValueBin (SilabsConfig::kConfigKey_Creds_KeyId , value.data (), value.size ());
@@ -573,7 +577,7 @@ CHIP_ERROR Storage::SignWithDeviceAttestationKey(const ByteSpan & message, Mutab
573
577
}
574
578
}
575
579
576
- #else // SLI_SI91X_MCU_INTERFACEX_MCU_INTERFACEX_MCU_INTERFACE
580
+ #else
577
581
578
582
CHIP_ERROR Storage::SetDeviceAttestationKey (const ByteSpan & value)
579
583
{
@@ -696,15 +700,6 @@ CHIP_ERROR Storage::GetTestEventTriggerKey(MutableByteSpan & keySpan)
696
700
697
701
} // namespace Provision
698
702
699
- void MigrateUint32 (uint32_t old_key, uint32_t new_key)
700
- {
701
- uint32_t value = 0 ;
702
- if (SilabsConfig::ConfigValueExists (old_key) && (CHIP_NO_ERROR == SilabsConfig::ReadConfigValue (old_key, value)))
703
- {
704
- SilabsConfig::WriteConfigValue (new_key, value);
705
- }
706
- }
707
-
708
703
void MigrateDacProvider (void )
709
704
{
710
705
constexpr uint32_t kOldKey_Creds_KeyId = SilabsConfigKey (SilabsConfig::kMatterConfig_KeyBase , 0x21 );
@@ -716,14 +711,14 @@ void MigrateDacProvider(void)
716
711
constexpr uint32_t kOldKey_Creds_CD_Offset = SilabsConfigKey (SilabsConfig::kMatterConfig_KeyBase , 0x27 );
717
712
constexpr uint32_t kOldKey_Creds_CD_Size = SilabsConfigKey (SilabsConfig::kMatterConfig_KeyBase , 0x28 );
718
713
719
- MigrateUint32 (kOldKey_Creds_KeyId , SilabsConfig::kConfigKey_Creds_KeyId );
720
- MigrateUint32 (kOldKey_Creds_Base_Addr , SilabsConfig::kConfigKey_Creds_Base_Addr );
721
- MigrateUint32 (kOldKey_Creds_DAC_Offset , SilabsConfig::kConfigKey_Creds_DAC_Offset );
722
- MigrateUint32 (kOldKey_Creds_DAC_Size , SilabsConfig::kConfigKey_Creds_DAC_Size );
723
- MigrateUint32 (kOldKey_Creds_PAI_Offset , SilabsConfig::kConfigKey_Creds_PAI_Offset );
724
- MigrateUint32 (kOldKey_Creds_PAI_Size , SilabsConfig::kConfigKey_Creds_PAI_Size );
725
- MigrateUint32 (kOldKey_Creds_CD_Offset , SilabsConfig::kConfigKey_Creds_CD_Offset );
726
- MigrateUint32 (kOldKey_Creds_CD_Size , SilabsConfig::kConfigKey_Creds_CD_Size );
714
+ MigrationManager:: MigrateUint32 (kOldKey_Creds_KeyId , SilabsConfig::kConfigKey_Creds_KeyId );
715
+ MigrationManager:: MigrateUint32 (kOldKey_Creds_Base_Addr , SilabsConfig::kConfigKey_Creds_Base_Addr );
716
+ MigrationManager:: MigrateUint32 (kOldKey_Creds_DAC_Offset , SilabsConfig::kConfigKey_Creds_DAC_Offset );
717
+ MigrationManager:: MigrateUint32 (kOldKey_Creds_DAC_Size , SilabsConfig::kConfigKey_Creds_DAC_Size );
718
+ MigrationManager:: MigrateUint32 (kOldKey_Creds_PAI_Offset , SilabsConfig::kConfigKey_Creds_PAI_Offset );
719
+ MigrationManager:: MigrateUint32 (kOldKey_Creds_PAI_Size , SilabsConfig::kConfigKey_Creds_PAI_Size );
720
+ MigrationManager:: MigrateUint32 (kOldKey_Creds_CD_Offset , SilabsConfig::kConfigKey_Creds_CD_Offset );
721
+ MigrationManager:: MigrateUint32 (kOldKey_Creds_CD_Size , SilabsConfig::kConfigKey_Creds_CD_Size );
727
722
}
728
723
729
724
} // namespace Silabs
0 commit comments