Skip to content

Commit

Permalink
Check SSS_ExportBlob return status
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com>
  • Loading branch information
andrei-menzopol committed Apr 3, 2024
1 parent 0504ab4 commit 42c0449
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,17 @@ CHIP_ERROR FactoryDataProviderImpl::SSS_ConvertDacKey()
uint8_t * data = static_cast<uint8_t *>(chip::Platform::MemoryAlloc(newSize));
uint32_t offset = 0;
bool convNeeded = true;
CHIP_ERROR error = CHIP_NO_ERROR;

VerifyOrReturnError(data != nullptr, CHIP_ERROR_INTERNAL);

error = SSS_ExportBlob(blob, &blobSize, offset, convNeeded);
ReturnErrorOnFailure(SSS_ExportBlob(blob, &blobSize, offset, convNeeded));
if (!convNeeded)
{
ChipLogError(DeviceLayer, "SSS: DAC private key already converted to blob");
chip::Platform::MemoryFree(data);
return CHIP_NO_ERROR;
}

ReturnErrorOnFailure(error);
ChipLogError(DeviceLayer, "SSS: extracted blob from DAC private key");

hal_flash_status_t status = HAL_FlashRead(kFactoryDataStart, newSize - kSssBlobMetadataLength, data);
Expand Down

0 comments on commit 42c0449

Please sign in to comment.