File tree Expand file tree Collapse file tree
config/nrfconnect/chip-module Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ if CHIP_CRYPTO_PSA_MIGRATE_DAC_PRIV_KEY
331331
332332choice CHIP_CRYPTO_PSA_DAC_PRIV_KEY_MIGRATION_DEST
333333 prompt "Destination for DAC private key migration"
334- default CHIP_CRYPTO_PSA_DAC_PRIV_KEY_KMU if CRACEN_LIB_KMU
334+ default CHIP_CRYPTO_PSA_DAC_PRIV_KEY_KMU if CRACEN_KMU
335335 default CHIP_CRYPTO_PSA_DAC_PRIV_KEY_ITS
336336
337337config CHIP_CRYPTO_PSA_DAC_PRIV_KEY_ITS
@@ -344,7 +344,7 @@ config CHIP_CRYPTO_PSA_DAC_PRIV_KEY_ITS
344344
345345config CHIP_CRYPTO_PSA_DAC_PRIV_KEY_KMU
346346 bool "Migrate DAC private key from factory data to CRACEN KMU"
347- depends on CRACEN_LIB_KMU
347+ depends on CRACEN_KMU
348348 help
349349 Move DAC private key from the factory data set to the CRACEN Key Management Unit (KMU) secure
350350 storage and remove it. After the first boot of the device the DAC private key will be
@@ -371,7 +371,7 @@ endif # CHIP_CRYPTO_PSA_MIGRATE_DAC_PRIV_KEY
371371
372372config CHIP_STORE_KEYS_IN_KMU
373373 bool "Use KMU to store crypto keys"
374- depends on CRACEN_LIB_KMU
374+ depends on CRACEN_KMU
375375 select EXPERIMENTAL
376376 help
377377 Stores cryptographic materials like keys in the KMU if available on the device.
Original file line number Diff line number Diff line change @@ -85,6 +85,9 @@ CHIP_ERROR FactoryDataProvider<FlashFactoryData>::Init()
8585 }
8686
8787#ifdef CONFIG_CHIP_CRYPTO_PSA
88+ #ifdef CHIP_CRYPTO_PSA_DAC_PRIV_KEY_KMU
89+ VerifyOrDie (FatalIfDACPrivateKeyInITS () == CHIP_NO_ERROR );
90+ #endif
8891 VerifyOrDie (MoveDACPrivateKeyToSecureStorage (factoryData, factoryDataSize) == CHIP_NO_ERROR );
8992#endif
9093
@@ -220,6 +223,27 @@ CHIP_ERROR FactoryDataProvider<FlashFactoryData>::MoveDACPrivateKeyToSecureStora
220223
221224 return CHIP_NO_ERROR ;
222225}
226+
227+ #ifdef CHIP_CRYPTO_PSA_DAC_PRIV_KEY_KMU
228+ template <class FlashFactoryData >
229+ CHIP_ERROR FactoryDataProvider<FlashFactoryData>::FatalIfDACPrivateKeyInITS()
230+ {
231+ const psa_key_id_t itsDacKeyId = to_underlying (chip::Crypto::KeyIdBase::DACPrivKey);
232+
233+ psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT ;
234+ if (psa_get_key_attributes (itsDacKeyId, &attributes) == PSA_SUCCESS )
235+ {
236+ psa_reset_key_attributes (&attributes);
237+ ChipLogError (DeviceLayer,
238+ " DAC private key found in PSA ITS while CRACEN KMU storage is configured. "
239+ " Automatic migration from ITS to KMU is not supported. "
240+ " Re-provision the device." );
241+ return CHIP_ERROR_INTERNAL ;
242+ }
243+
244+ return CHIP_NO_ERROR ;
245+ }
246+ #endif // CHIP_CRYPTO_PSA_DAC_PRIV_KEY_KMU
223247#endif // CONFIG_CHIP_CRYPTO_PSA
224248
225249template <class FlashFactoryData >
Original file line number Diff line number Diff line change @@ -153,6 +153,10 @@ class FactoryDataProvider : public FactoryDataProviderBase
153153 CHIP_ERROR MoveDACPrivateKeyToSecureStorage (uint8_t * factoryDataPartition, size_t factoryDataSize);
154154#endif
155155
156+ #ifdef CHIP_CRYPTO_PSA_DAC_PRIV_KEY_KMU
157+ CHIP_ERROR FatalIfDACPrivateKeyInITS ();
158+ #endif // CHIP_CRYPTO_PSA_DAC_PRIV_KEY_KMU
159+
156160 // ===== Members functions that implement the DeviceAttestationCredentialsProvider
157161 CHIP_ERROR GetCertificationDeclaration (MutableByteSpan & outBuffer) override ;
158162 CHIP_ERROR GetFirmwareInformation (MutableByteSpan & out_firmware_info_buffer) override ;
You can’t perform that action at this time.
0 commit comments