Changes

1,050 bytes added ,  20:22, 29 January 2021
→‎Beacon: Fully document the Nintendo IEs. Note: the Action frame is the same, except its encrypted section has app-provided data rather than TLVs -- if anyone wants to edit that in. :)
Line 1,562: Line 1,562:  
Note that during group creation the beacon may be missing the Nintendo IEs in some cases, since group creation didn't finish yet.
 
Note that during group creation the beacon may be missing the Nintendo IEs in some cases, since group creation didn't finish yet.
   −
The first Nintendo IE (ID 0x0600) contains the following data:
+
==== Nintendo IE 0 ====
 +
 
 +
The first Nintendo IE (ID 0x0600) contains the following fixed parameters:
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 1,570: Line 1,572:  
! Description
 
! Description
 
|-
 
|-
| 0x0 || 0x2 || Usually 20 02?(Second byte depends on whether encryption is used?)
+
| 0x0 || 0x1 || Fixed 0x20; perhaps a version or other magic number.
 +
|-
 +
| 0x1 || 0x1 || [[#GroupInfo|SecurityType]]
 +
|-
 +
| 0x2 || 0x1 || [[#GroupInfo|StaticAesKeyIndex]]
 +
|-
 +
| 0x3 || 0x1 || Fixed zero; padding byte.
 
|-
 
|-
| 0x2 || 0x2 || Usually 01 00 or 02 00?(varies)
+
| 0x4 || 0x8 || Big-endian (i.e. byte-reversed) version of [[#GroupInfo|LocalCommunicationId]]. This is the only context where LocalCommunicationId is reversed.
 
|-
 
|-
| 0x4 || 0x8 || Big-endian version of [[#GroupInfo]]+0x10.
+
| 0xC || 0x10 || Wrapped master key. Same as [[#GroupInfo]]+0x0.
 
|-
 
|-
| 0xC || 0x10 || Same as [[#GroupInfo]]+0x0.
+
| 0x1C || 0x4 || If encryption is enabled, a randomly-generated nonce, else nothing. Appending 8 zero bytes to this yields the AES-GCM IV.
 
|-
 
|-
| 0x1C || || Start of encrypted (and crypto-related) data if enabled. 0x22-bytes when encrypted, 0xE-bytes when plaintext.
+
| 0x20 || 0x10 || If encryption is enabled, the AES-GCM MAC tag, else nothing. All bytes prior to this (fixed 0x20 through nonce) are the additional authenticated data. All bytes after this are encrypted with key B.
 
|}
 
|}
   −
The second Nintendo IE (ID 0x0601) contains the following data (data is encrypted if enabled, there's also an additional 0x14-bytes when encrypted):
+
After this, TLV tagged parameters occur. Each TLV tag is formatted as:
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 1,589: Line 1,597:  
! Description
 
! Description
 
|-
 
|-
| 0x0 || 0x1 || Plaintext: usually 21?
+
| 0x0 || 0x1 || Tag type
 +
|-
 +
| 0x1 || 0x1 || Length
 +
|-
 +
| 0x2 || {above size} || Data for the tag
 +
|}
 +
 
 +
Known TLV tags:
 +
 
 +
{| class="wikitable" border="1"
 
|-
 
|-
| 0x1 || 0x1 || Plaintext: AdvertiseData size
+
! Type
 +
! Size
 +
! Description
 +
|-
 +
| 0x1 || 0x2 || Additional network parameters: 0xAB 0xCD. A=[[#GroupInfo]]+0x82, B=[[#GroupInfo|MemberCountMax]], C=[[#GroupInfo|NetworkMode]], D=[[#GroupInfo|PerformanceRequirement]].
 +
|-
 +
| 0x2 || 0x8 || Flags: Bitwise-or of (1<<f) for each entry in [[#GroupInfo]]+0x40
 +
|}
 +
 
 +
==== Nintendo IE 1 ====
 +
 
 +
The second Nintendo IE (ID 0x0601) contains only TLVs. If encryption is enabled, a 0x4-byte nonce and 0x10-byte AES-GCM tag are written first, as above, and the TLVs are encrypted. Key C is used.
 +
 
 +
Known TLV tags:
 +
 
 +
{| class="wikitable" border="1"
 +
|-
 +
! Type
 +
! Size
 +
! Description
 
|-
 
|-
| 0x2 || {above size} || Plaintext: AdvertiseData
+
| 0x21 || Varies || AdvertiseData
 
|}
 
|}
  
30

edits