LDN services: Difference between revisions

Line 1,662: Line 1,662:
When encryption is enabled, the encrypted data is at +0x28 (+0x38 with EncryptionType3) with size {remaining frame size}. The key is derived from the raw 0x20-bytes at +0x0. The CTR/IV is {raw Counter above without byte-swap}, with the rest cleared to zeros. The AAD for AES-128-GCM is at +0x0 size 0x28-bytes.
When encryption is enabled, the encrypted data is at +0x28 (+0x38 with EncryptionType3) with size {remaining frame size}. The key is derived from the raw 0x20-bytes at +0x0. The CTR/IV is {raw Counter above without byte-swap}, with the rest cleared to zeros. The AAD for AES-128-GCM is at +0x0 size 0x28-bytes.


The content data at +{above_header_size} follows, which has the size specified above (which must be >=0x500), where all fields are big-endian:
The content data at +{above_header_size} follows, which has the size specified above (which must be >=0x500), where all fields are big-endian. For EncryptionType1-2:


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 1,693: Line 1,693:
|-
|-
| 0x4F8 || 0x8 || [6.0.0+] [[#NetworkInfo]]+0x478
| 0x4F8 || 0x8 || [6.0.0+] [[#NetworkInfo]]+0x478
|}
For EncryptionType3:
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x10 || [[#NetworkInfo]]+0x50
|-
| 0x1A || 0x2 || Bit7 must be clear.
|-
| 0x26 || 0x1 || s8 [[#NetworkInfo]]+0x66 (NodeCountMax)
|-
| 0x27 || 0x1 || s8 [[#NetworkInfo]]+0x67 (NodeCount)
|-
| 0x28 || NodeCount*0x30 || Array of the below node struct.
|-
| 0x28 + (NodeCount*0x30) || 0x2 || [[#NetworkInfo]]+0x26A (AdvertiseDataSize)
|-
| 0x2A + (NodeCount*0x30) || AdvertiseDataSize || [[#NetworkInfo]]+0x26C (AdvertiseData)
|}
|}


The data here is copied into [[#NetworkInfo]].
The data here is copied into [[#NetworkInfo]].


Node data used in the above array (all fields big-endian), which are copied into the [[#NetworkInfo]] [[#NodeInfo|NodeInfo]] array:
Node data used in the above array (all fields big-endian), which are copied into the [[#NetworkInfo]] [[#NodeInfo|NodeInfo]] array. For EncryptionType1-2:


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 1,718: Line 1,741:
|-
|-
| 0x2E || 0xA || Unused
| 0x2E || 0xA || Unused
|}
For EncryptionType3:
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x4 || [[#Ipv4Address]]
|-
| 0x4 || 0x6 || [[#MacAddress|MacAddress]]
|-
| 0xA || 0x1 ||
|-
| 0xB || 0x1 ||
|-
| 0xC || 0x20 || First 0x20-bytes of [[#UserConfig]].
|}
|}