From 5ff609f4c32de3e62568d71ac896695ea5fca204 Mon Sep 17 00:00:00 2001 From: Adrian Gielniewski Date: Mon, 10 Mar 2025 17:42:02 +0100 Subject: [PATCH] Log VerifyCredentials error Log error coming from `VerifyCredentials` as it's later overwritten with `CHIP_ERROR_UNSUPPORTED_CERT_FORMAT` which hides root cause of the failure. Signed-off-by: Adrian Gielniewski --- src/credentials/FabricTable.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/credentials/FabricTable.cpp b/src/credentials/FabricTable.cpp index 87a408cc8c7b04..f6ba9d3226bf49 100644 --- a/src/credentials/FabricTable.cpp +++ b/src/credentials/FabricTable.cpp @@ -346,15 +346,17 @@ CHIP_ERROR FabricTable::ValidateIncomingNOCChain(const ByteSpan & noc, const Byt ChipLogProgress(FabricProvisioning, "Validating NOC chain"); CHIP_ERROR err = FabricTable::VerifyCredentials(noc, icac, rcac, validContext, outCompressedFabricId, outFabricId, outNodeId, outNocPubkey, &outRootPubkey); - if (err != CHIP_NO_ERROR && err != CHIP_ERROR_WRONG_NODE_ID) - { - err = CHIP_ERROR_UNSUPPORTED_CERT_FORMAT; - } if (err != CHIP_NO_ERROR) { - ChipLogError(FabricProvisioning, "Failed NOC chain validation: %" CHIP_ERROR_FORMAT, err.Format()); + ChipLogError(FabricProvisioning, "Failed NOC chain validation, VerifyCredentials returned: %" CHIP_ERROR_FORMAT, + err.Format()); + + if (err != CHIP_ERROR_WRONG_NODE_ID) + { + err = CHIP_ERROR_UNSUPPORTED_CERT_FORMAT; + } + return err; } - ReturnErrorOnFailure(err); // Validate fabric ID match for cases like UpdateNOC. if (existingFabricId != kUndefinedFabricId)