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)