From 5ff3dc7df4c5850d9b0b6b38d2e231e22485ceba Mon Sep 17 00:00:00 2001 From: Arkadiusz Balys Date: Wed, 3 Jan 2024 14:17:45 +0100 Subject: [PATCH] Changed a names a bit --- src/platform/nrfconnect/FactoryDataProvider.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/platform/nrfconnect/FactoryDataProvider.cpp b/src/platform/nrfconnect/FactoryDataProvider.cpp index 3994c8bfee..1d7333d3f3 100644 --- a/src/platform/nrfconnect/FactoryDataProvider.cpp +++ b/src/platform/nrfconnect/FactoryDataProvider.cpp @@ -171,15 +171,15 @@ CHIP_ERROR FactoryDataProvider::MoveDACPrivateKeyToSecureStora size_t requiredFlashSpaceSize = ROUND_UP(kDACPrivateKeyLength + bytesToLeftBefore, flashParameters->write_block_size); size_t bytesToLeftAfter = requiredFlashSpaceSize - bytesToLeftBefore - kDACPrivateKeyLength; - // Allocate the memory buffer for migration. - chip::Platform::ScopedMemoryBuffer newDADBuffer; - VerifyOrReturnError(newDADBuffer.Calloc(requiredFlashSpaceSize), CHIP_ERROR_NO_MEMORY); + // Allocate the memory buffer for removing DAC private key. + chip::Platform::ScopedMemoryBuffer removedPrivKeyBuffer; + VerifyOrReturnError(removedPrivKeyBuffer.Calloc(requiredFlashSpaceSize), CHIP_ERROR_NO_MEMORY); // Copy the existing parts of the aligned memory space to before and after the DAC private key space. - memcpy(newDADBuffer.Get(), factoryDataPartition, bytesToLeftBefore); - memcpy(newDADBuffer.Get() + bytesToLeftBefore + kDACPrivateKeyLength, factoryDataPartition, bytesToLeftAfter); + memcpy(removedPrivKeyBuffer.Get(), factoryDataPartition, bytesToLeftBefore); + memcpy(removedPrivKeyBuffer.Get() + bytesToLeftBefore + kDACPrivateKeyLength, factoryDataPartition, bytesToLeftAfter); // Write aligned buffer directly to the Flash without erasing. VerifyOrReturnError(0 == - flash_write(kFlashDev, kFactoryDataPartitionAddress + alignedDacPrivKeyOffset, newDADBuffer.Get(), + flash_write(kFlashDev, kFactoryDataPartitionAddress + alignedDacPrivKeyOffset, removedPrivKeyBuffer.Get(), requiredFlashSpaceSize), CHIP_ERROR_INTERNAL); // Parse the factory Data again and verify if the procedure finished successfully