Skip to content

Commit

Permalink
Add mandatory existence of timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmelveilleux committed Nov 18, 2021
1 parent cd5f49c commit 8f089a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/credentials/DeviceAttestationConstructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ CHIP_ERROR DeconstructAttestationElements(const ByteSpan & attestationElements,
{
bool certificationDeclarationExists = false;
bool attestationNonceExists = false;
bool timestampExists = false;
bool gotFirstContextTag = false;
uint32_t lastContextTagId = 0;

Expand Down Expand Up @@ -117,6 +118,7 @@ CHIP_ERROR DeconstructAttestationElements(const ByteSpan & attestationElements,
break;
case kTimestampTagId:
ReturnErrorOnFailure(tlvReader.Get(timestamp));
timestampExists = true;
break;
case kFirmwareInfoTagId:
ReturnErrorOnFailure(tlvReader.GetByteView(firmwareInfo));
Expand All @@ -130,7 +132,7 @@ CHIP_ERROR DeconstructAttestationElements(const ByteSpan & attestationElements,

VerifyOrReturnError(error == CHIP_NO_ERROR || error == CHIP_END_OF_TLV, error);

const bool allTagsNeededPresent = certificationDeclarationExists && attestationNonceExists;
const bool allTagsNeededPresent = certificationDeclarationExists && attestationNonceExists && timestampExists;
VerifyOrReturnError(allTagsNeededPresent, CHIP_ERROR_MISSING_TLV_ELEMENT);

size_t count = 0;
Expand Down

0 comments on commit 8f089a9

Please sign in to comment.