From a2845d9a2b1badc4238235b3eac5adfb2e3a7584 Mon Sep 17 00:00:00 2001 From: Rohan Sahay <103027015+rosahay-silabs@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:53:35 +0530 Subject: [PATCH] [SL-UP] Revert provision keystore to maintain backward compatibility (#205) --- .../silabs/provision/ProvisionStorageFlash.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/examples/platform/silabs/provision/ProvisionStorageFlash.cpp b/examples/platform/silabs/provision/ProvisionStorageFlash.cpp index 2522fb07a06fb5..83d2d2ff29c90e 100644 --- a/examples/platform/silabs/provision/ProvisionStorageFlash.cpp +++ b/examples/platform/silabs/provision/ProvisionStorageFlash.cpp @@ -634,14 +634,7 @@ CHIP_ERROR Storage::GetDeviceAttestationCert(MutableByteSpan & value) CHIP_ERROR Storage::SetDeviceAttestationKey(const ByteSpan & value) { -#if (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE) - uint8_t temp[kDeviceAttestationKeySizeMax] = { 0 }; - MutableByteSpan private_key(temp); - AttestationKey::Unwrap(value.data(), value.size(), private_key); - return Flash::Set(Parameters::ID::kDacKey, private_key.data(), private_key.size()); -#else return Flash::Set(Parameters::ID::kDacKey, value.data(), value.size()); -#endif // SLI_SI91X_MCU_INTERFACE } CHIP_ERROR Storage::GetDeviceAttestationCSR(uint16_t vid, uint16_t pid, const CharSpan & cn, MutableCharSpan & csr) @@ -668,7 +661,10 @@ CHIP_ERROR Storage::SignWithDeviceAttestationKey(const ByteSpan & message, Mutab #endif // CHIP_DEVICE_CONFIG_ENABLE_EXAMPLE_CREDENTIALS ReturnErrorOnFailure(err); #if (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE) - return AttestationKey::SignMessageWithKey(temp, message, signature); + uint8_t key_buffer[kDeviceAttestationKeySizeMax] = { 0 }; + MutableByteSpan private_key(key_buffer); + AttestationKey::Unwrap(temp, size, private_key); + return AttestationKey::SignMessageWithKey((const uint8_t *) key_buffer, message, signature); #else AttestationKey key; ReturnErrorOnFailure(key.Import(temp, size));