LDN services: Difference between revisions
No edit summary |
No edit summary |
||
| Line 265: | Line 265: | ||
=== SetProtocol === | === SetProtocol === | ||
Takes an input u32, no output. | Takes an input [[#Protocol|u32]], no output. | ||
This cmd was implemented with [20.0.0+], prior to that this just returned an error. | This cmd was implemented with [20.0.0+], prior to that this just returned an error. | ||
| Line 275: | Line 275: | ||
The input is validated, then a vfunc is called. | The input is validated, then a vfunc is called. | ||
The cmd_input must be non-zero. BIT(cmd_input) must be set in a state-field, otherwise a separate Result is returned. | The cmd_input must be non-zero. BIT(cmd_input) must be set in a state-field, otherwise a separate Result is returned. This is a permission [[#Protocol|bitmask]] which originates from the ldn:* service object being used. | ||
The vfunc sends a message to another thread with the input u32 as the param, and returns the response from that. | The vfunc sends a message to another thread with the input u32 as the param, and returns the response from that. | ||
The thread msg-queue-handler (besides other validation) uses the input param to select what values to write to state fields. | The thread msg-queue-handler (besides other validation) uses the input param to select what values to write to state fields. On NX only input value 1 or 3 is allowed, with an error being thrown otherwise. The previously mentioned validation includes verifying that [[#GetState|State]] is Initialized. | ||
=== OpenAccessPoint === | === OpenAccessPoint === | ||
| Line 541: | Line 539: | ||
[18.0.0+] The sdknso uses SessionManager with this, where the additional session-count is 0x3. | [18.0.0+] The sdknso uses SessionManager with this, where the additional session-count is 0x3. | ||
[S2] There appears to be 2 ldn:u services, this appears to be for having separate [[#Protocol|Protocol]] permissions for NX and Ounce games. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
| Line 1,482: | Line 1,482: | ||
Protocol2 and Protocol4 appear to be identical to Protocol3 except for using [[SPL_services|Ounce]] keys (?), with AES-128. It's unknown exactly which Protocol uses which [[SPL_services|Generation]], though presumably 2/4 is Generation 0x0/0x1? lcs (local-content-share) uses Generation 0x1, while Mario Kart World uses 0x0. | Protocol2 and Protocol4 appear to be identical to Protocol3 except for using [[SPL_services|Ounce]] keys (?), with AES-128. It's unknown exactly which Protocol uses which [[SPL_services|Generation]], though presumably 2/4 is Generation 0x0/0x1? lcs (local-content-share) uses Generation 0x1, while Mario Kart World uses 0x0. | ||
On NX, the Protocol [[#SetProtocol|permission-bitmask]] is always set to 0xA (1 and 3). On Ounce, all services have this set to 0x1E, except for one which has it set to 0xA (which is likely the one for S1-compat). 0x1E allows additional protocol values 2 and 4. | |||
= ActionFrameSettings = | = ActionFrameSettings = | ||
| Line 1,703: | Line 1,705: | ||
| 0x4 || 0x1 || [6.0.0+] High u8 for the size. | | 0x4 || 0x1 || [6.0.0+] High u8 for the size. | ||
|- | |- | ||
| 0x5 || 0x1 || [20.0.0+] AuthEncryptionType, must match the type being used by the [[#Protocol|Protocol]]. 0 = plaintext ([[#Protocol|Protocol]] NX), 1 = AES-128-GCM ([[#Protocol|Protocol]] | | 0x5 || 0x1 || [20.0.0+] AuthEncryptionType, must match the type being used by the [[#Protocol|Protocol]]. 0 = plaintext ([[#Protocol|Protocol]] NX), 1 = AES-128-GCM ([[#Protocol|Protocol]] non-NX). | ||
|- | |- | ||
| 0x6 || 0x2 || Unused, zeros. | | 0x6 || 0x2 || Unused, zeros. | ||
| Line 1,834: | Line 1,836: | ||
|} | |} | ||
Using EncryptionType3 outside of [[#Scan]]/[[#ScanPrivate]] is enabled with [[#Protocol|Protocol]] | Using EncryptionType3 outside of [[#Scan]]/[[#ScanPrivate]] is enabled with [[#Protocol|Protocol]] non-NX. | ||
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. | ||