@@ -187,7 +187,12 @@ CHIP_ERROR FabricInfo::GetCompressedId(FabricId fabricId, NodeId nodeId, PeerId
187
187
uint8_t compressedFabricIdBuf[sizeof (uint64_t )];
188
188
MutableByteSpan compressedFabricIdSpan (compressedFabricIdBuf);
189
189
P256PublicKey rootPubkey (GetRootPubkey ());
190
+ ChipLogDetail (Inet, " Generating compressed fabric ID using uncompressed fabric ID 0x" ChipLogFormatX64 " and root pubkey" ,
191
+ ChipLogValueX64 (fabricId));
192
+ ChipLogByteSpan (Inet, ByteSpan (rootPubkey.ConstBytes (), rootPubkey.Length ()));
190
193
ReturnErrorOnFailure (GenerateCompressedFabricId (rootPubkey, fabricId, compressedFabricIdSpan));
194
+ ChipLogDetail (Inet, " Generated compressed fabric ID" );
195
+ ChipLogByteSpan (Inet, compressedFabricIdSpan);
191
196
192
197
// Decode compressed fabric ID accounting for endianness, as GenerateCompressedFabricId()
193
198
// returns a binary buffer and is agnostic of usage of the output as an integer type.
@@ -325,12 +330,19 @@ CHIP_ERROR FabricInfo::GenerateDestinationID(const ByteSpan & ipk, const ByteSpa
325
330
326
331
Encoding::LittleEndian::BufferWriter bbuf (destinationMessage, sizeof (destinationMessage));
327
332
333
+ ChipLogDetail (Inet,
334
+ " Generating DestinationID. Fabric ID 0x" ChipLogFormatX64 " , Dest node ID 0x" ChipLogFormatX64 " , Random data" ,
335
+ ChipLogValueX64 (mFabricId ), ChipLogValueX64 (destNodeId));
336
+ ChipLogByteSpan (Inet, random );
337
+
328
338
bbuf.Put (random .data (), random .size ());
329
339
// TODO: In the current implementation this check is required because in some cases the
330
340
// GenerateDestinationID() is called before mRootCert is initialized and GetRootPubkey() returns
331
341
// empty Span.
332
342
if (!rootPubkeySpan.empty ())
333
343
{
344
+ ChipLogDetail (Inet, " Root pubkey" );
345
+ ChipLogByteSpan (Inet, rootPubkeySpan);
334
346
bbuf.Put (rootPubkeySpan.data (), rootPubkeySpan.size ());
335
347
}
336
348
bbuf.Put64 (mFabricId );
@@ -339,8 +351,13 @@ CHIP_ERROR FabricInfo::GenerateDestinationID(const ByteSpan & ipk, const ByteSpa
339
351
size_t written = 0 ;
340
352
VerifyOrReturnError (bbuf.Fit (written), CHIP_ERROR_BUFFER_TOO_SMALL);
341
353
354
+ ChipLogDetail (Inet, " IPK" );
355
+ ChipLogByteSpan (Inet, ipk);
356
+
342
357
CHIP_ERROR err =
343
358
hmac.HMAC_SHA256 (ipk.data (), ipk.size (), destinationMessage, written, destinationId.data (), destinationId.size ());
359
+ ChipLogDetail (Inet, " Generated DestinationID output" );
360
+ ChipLogByteSpan (Inet, destinationId);
344
361
return err;
345
362
}
346
363
0 commit comments