Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
  • Loading branch information
mkardous-silabs and bzbarsky-apple authored Dec 8, 2023
1 parent cc38e83 commit 5b13467
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app/icd/ICDMonitoringTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ CHIP_ERROR ICDMonitoringEntry::Deserialize(TLV::TLVReader & reader)
// Since we are storing either the raw key or a key ID, we must
// simply copy the data as is in the keyHandle.
// Calling SetKey here would create another keyHandle in storage and will cause
// keyHandle leakage in some implementations.
// keyHandle leaks in some implementations.
memcpy(aesKeyHandle.AsMutable<Crypto::Symmetric128BitsKeyByteArray>(), buf.data(),
sizeof(Crypto::Symmetric128BitsKeyByteArray));
keyHandleValid = true;
Expand All @@ -101,7 +101,7 @@ CHIP_ERROR ICDMonitoringEntry::Deserialize(TLV::TLVReader & reader)
// Since we are storing either the raw key or a key ID, we must
// simply copy the data as is in the keyHandle.
// Calling SetKey here would create another keyHandle in storage and will cause
// keyHandle leakage in some implementations.
// keyHandle leaks in some implementations.
memcpy(hmacKeyHandle.AsMutable<Crypto::Symmetric128BitsKeyByteArray>(), buf.data(),
sizeof(Crypto::Symmetric128BitsKeyByteArray));
}
Expand Down Expand Up @@ -144,7 +144,7 @@ CHIP_ERROR ICDMonitoringEntry::SetKey(ByteSpan keyData)
}
else
{
// Creation of the HmacKeyHandle failed, we need to delete the AesKeyHandle to avoid a key leakage
// Creation of the HmacKeyHandle failed, we need to delete the AesKeyHandle to avoid a key leak
symmetricKeystore->DestroyKey(this->aesKeyHandle);
}

Expand Down Expand Up @@ -272,7 +272,7 @@ CHIP_ERROR ICDMonitoringTable::Remove(uint16_t index)
ICDMonitoringEntry entry(mSymmetricKeystore, this->mFabric);

// Retrieve entry and delete the keyHandle first as to not
// cause any key leakages.
// cause any key leaks.
this->Get(index, entry);
ReturnErrorOnFailure(entry.DeleteKey());

Expand Down

0 comments on commit 5b13467

Please sign in to comment.