Changes

Jump to navigation Jump to search
64 bytes added ,  20:52, 22 March 2022
Line 1: Line 1: −
The Gamecard ASIC (known internally as the LOTUS3) is a separate chip on the motherboard responsible for communicating with the [[Gamecard]].
+
Lotus3 is the Gamecard ASIC, which is a separate chip on the motherboard responsible for communicating with the [[Gamecard]].
    
It is the Tegra's SDMMC2 device on the Switch and [[Filesystem_services|FS]] communicates with it using a custom protocol based on vendor specific MMC commands.
 
It is the Tegra's SDMMC2 device on the Switch and [[Filesystem_services|FS]] communicates with it using a custom protocol based on vendor specific MMC commands.
Line 15: Line 15:  
|-
 
|-
 
| 61
 
| 61
| [[#GetOperationStatus]]
+
| [[#FinishOperation]]
 
|-
 
|-
 
| 62
 
| 62
| [[#PutToSleep]]
+
| [[#Sleep]]
 
|-
 
|-
 
| 63
 
| 63
| [[#ResetKeyData]]
+
| [[#UpdateKey]]
 
|}
 
|}
   Line 47: Line 47:  
|}
 
|}
   −
== GetOperationStatus ==
+
== FinishOperation ==
 
Returns the status of a completed operation.
 
Returns the status of a completed operation.
   −
== PutToSleep ==
+
== Sleep ==
 
Puts the Gamecard ASIC in sleep mode.
 
Puts the Gamecard ASIC in sleep mode.
   −
== ResetKeyData ==
+
== UpdateKey ==
 
Tells the Gamecard ASIC to generate new random key data.
 
Tells the Gamecard ASIC to generate new random key data.
    
= ASIC commands =
 
= ASIC commands =
The Gamecard ASIC supports a total of 19 operation commands. These commands are passed to the ASIC using the [[#WriteOperation]] MMC command.
+
The Gamecard ASIC supports a total of 20 operation commands. These commands are passed to the ASIC using the [[#WriteOperation]] MMC command.
    
Additional data buffers are then read/written using standard MMC read/write commands.
 
Additional data buffers are then read/written using standard MMC read/write commands.
Line 67: Line 67:  
|-
 
|-
 
| 0x01
 
| 0x01
| [[#SetUserAsicFirmware]]
+
| [[#SendFirmware]]
 
|-
 
|-
 
| 0x02
 
| 0x02
| [[#GetAsicCert]]
+
| [[#ReceiveCertificate]]
 
|-
 
|-
 
| 0x03
 
| 0x03
| [[#SetEmmcEmbeddedSocCertificate]]
+
| [[#SendSocCertificate]]
 
|-
 
|-
 
| 0x04
 
| 0x04
| [[#GetAsicEncryptedMessage]]
+
| [[#ReceiveRandomValue]]
 
|-
 
|-
 
| 0x05
 
| 0x05
| [[#SetLibraryEncryptedMessage]]
+
| [[#SendRandomValue]]
 
|-
 
|-
 
| 0x06
 
| 0x06
| [[#GetAsicAuthenticationData]]
+
| [[#ReceiveDeviceChallenge]]
 
|-
 
|-
 
| 0x07
 
| 0x07
| [[#SetAsicAuthenticationDataHash]]
+
| [[#RespondDeviceChallenge]]
 
|-
 
|-
 
| 0x08
 
| 0x08
| [[#SetLibraryAuthenticationData]]
+
| [[#SendHostChallenge]]
 
|-
 
|-
 
| 0x09
 
| 0x09
| [[#GetLibraryAuthenticationDataHash]]
+
| [[#ReceiveChallengeResponse]]
 
|-
 
|-
 
| 0x0A
 
| 0x0A
| [[#EnterSecureAsicMode]]
+
| [[#ChangeModeToSecure]]
 
|-
 
|-
 
| 0x0B
 
| 0x0B
| [[#WriteAsicRegister]]
+
| [[#WriteRegister]]
 
|-
 
|-
 
| 0x0C
 
| 0x0C
| [[#ReadAsicRegister]]
+
| [[#ReadRegister]]
 
|-
 
|-
 
| 0x0D
 
| 0x0D
| [[#ChangeDebugMode]]
+
| [[#ChangeGcModeToDebug]]
 
|-
 
|-
 
| 0x0E
 
| 0x0E
Line 109: Line 109:  
|-
 
|-
 
| 0x0F
 
| 0x0F
| [[#GetCardKeyArea]]
+
| [[#ChangeGcModeToSecure]]
 
|-
 
|-
 
| 0x10
 
| 0x10
Line 121: Line 121:  
|-
 
|-
 
| 0x13
 
| 0x13
| [[#GetRmaInformation]]
+
| [[#ReadRmaInformation]]
 +
|-
 +
| 0x14
 +
| [9.0.0+] [[#ChallengeCardExistence]]
 
|}
 
|}
   −
== SetUserAsicFirmware ==
+
== SendFirmware ==
 
Signals the Gamecard ASIC to receive a 0x7800 byte sized buffer containing the [[#User firmware|ASIC's user firmware]].
 
Signals the Gamecard ASIC to receive a 0x7800 byte sized buffer containing the [[#User firmware|ASIC's user firmware]].
   −
== GetAsicCert ==
+
== ReceiveCertificate ==
 
Signals the Gamecard ASIC to send a 0x400 byte sized buffer containing the ASIC's certificate.
 
Signals the Gamecard ASIC to send a 0x400 byte sized buffer containing the ASIC's certificate.
   −
== SetEmmcEmbeddedSocCertificate ==
+
== SendSocCertificate ==
 
Signals the Gamecard ASIC to receive a 0x400 byte sized buffer containing the certificate from [[Settings_services#GetGameCardCertificate|GetGameCardCertificate]].
 
Signals the Gamecard ASIC to receive a 0x400 byte sized buffer containing the certificate from [[Settings_services#GetGameCardCertificate|GetGameCardCertificate]].
   −
== GetAsicEncryptedMessage ==
+
== ReceiveRandomValue ==
 
Signals the Gamecard ASIC to send a 0x100 byte sized buffer containing a RSA-OAEP encrypted message to be decrypted by the host library. The decrypted message will be used to generate a common AES-128 (CBC and CTR) key and IV/CTR shared between the ASIC and the host library.
 
Signals the Gamecard ASIC to send a 0x100 byte sized buffer containing a RSA-OAEP encrypted message to be decrypted by the host library. The decrypted message will be used to generate a common AES-128 (CBC and CTR) key and IV/CTR shared between the ASIC and the host library.
   −
== SetLibraryEncryptedMessage ==
+
== SendRandomValue ==
 
Signals the Gamecard ASIC to receive a 0x100 byte sized buffer containing a RSA-OAEP encrypted message to be decrypted by the ASIC. The decrypted message will be used to generate a common AES-128 (CBC and CTR) key and IV/CTR shared between the ASIC and the host library.
 
Signals the Gamecard ASIC to receive a 0x100 byte sized buffer containing a RSA-OAEP encrypted message to be decrypted by the ASIC. The decrypted message will be used to generate a common AES-128 (CBC and CTR) key and IV/CTR shared between the ASIC and the host library.
   −
== GetAsicAuthenticationData ==
+
== ReceiveDeviceChallenge ==
 
Signals the Gamecard ASIC to send a 0x20 byte sized buffer containing AES-128-CBC encrypted authentication data to be decrypted and hashed by the host library.
 
Signals the Gamecard ASIC to send a 0x20 byte sized buffer containing AES-128-CBC encrypted authentication data to be decrypted and hashed by the host library.
   −
== SetAsicAuthenticationDataHash ==
+
== RespondDeviceChallenge ==
 
Signals the Gamecard ASIC to receive a 0x20 byte sized buffer containing the AES-128-CBC encrypted hash of the ASIC authentication data.
 
Signals the Gamecard ASIC to receive a 0x20 byte sized buffer containing the AES-128-CBC encrypted hash of the ASIC authentication data.
   −
== SetLibraryAuthenticationData ==
+
== SendHostChallenge ==
 
Signals the Gamecard ASIC to receive a 0x20 byte sized buffer containing AES-128-CBC encrypted authentication data to be decrypted and hashed by the ASIC.
 
Signals the Gamecard ASIC to receive a 0x20 byte sized buffer containing AES-128-CBC encrypted authentication data to be decrypted and hashed by the ASIC.
   −
== GetLibraryAuthenticationDataHash ==
+
== ReceiveChallengeResponse ==
 
Signals the Gamecard ASIC to send a 0x20 byte sized buffer containing the AES-128-CBC encrypted hash of the library authentication data.
 
Signals the Gamecard ASIC to send a 0x20 byte sized buffer containing the AES-128-CBC encrypted hash of the library authentication data.
   −
== EnterSecureAsicMode ==
+
== ChangeModeToSecure ==
 
Signals the Gamecard ASIC to enter secure mode. In secure mode, all communication with the Gamecard ASIC must be AES-128-CTR encrypted.
 
Signals the Gamecard ASIC to enter secure mode. In secure mode, all communication with the Gamecard ASIC must be AES-128-CTR encrypted.
   −
== WriteAsicRegister ==
+
== WriteRegister ==
 
Signals the Gamecard ASIC to write an internal register. The register value is passed in the first word of a 0x200 byte sized buffer while the register index is passed in the actual [[#OperationBuffer]] as follows.
 
Signals the Gamecard ASIC to write an internal register. The register value is passed in the first word of a 0x200 byte sized buffer while the register index is passed in the actual [[#OperationBuffer]] as follows.
   Line 184: Line 187:  
|}
 
|}
   −
== ReadAsicRegister ==
+
== ReadRegister ==
Signals the Gamecard ASIC to send a 0x30 byte sized buffer containing the values of all ASIC registers.
+
Signals the Gamecard ASIC to send a 0x30 byte sized buffer containing the values of all ASIC registers as follows.
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 242: Line 245:  
|}
 
|}
   −
== ChangeDebugMode ==
+
== ChangeGcModeToDebug ==
 
Signals the Gamecard ASIC to change into debug mode and send a 0x200 byte sized buffer containing information on the current Gamecard.
 
Signals the Gamecard ASIC to change into debug mode and send a 0x200 byte sized buffer containing information on the current Gamecard.
   Line 256: Line 259:  
| 0x0
 
| 0x0
 
| 0x4
 
| 0x4
| CUP Version
+
| [[Gamecard_Format#Gamecard_Info|CUP Version]]
 
|-
 
|-
 
| 0x4
 
| 0x4
Line 267: Line 270:  
|}
 
|}
   −
== GetCardKeyArea ==
+
== ChangeGcModeToSecure ==
Signals the Gamecard ASIC to send a 0x800 byte sized buffer containing the current Gamecard's key area sectors.
+
Signals the Gamecard ASIC to send a 0x800 byte sized buffer containing the current Gamecard's key area sectors as follows.
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 360: Line 363:  
|}
 
|}
   −
== GetRmaInformation ==
+
== ReadRmaInformation ==
 
Signals the Gamecard ASIC to send a 0x200 byte sized buffer containing information on the Gamecard ASIC. This is called by [[Filesystem_services#IDeviceOperator|GetGameCardAsicInfo]].
 
Signals the Gamecard ASIC to send a 0x200 byte sized buffer containing information on the Gamecard ASIC. This is called by [[Filesystem_services#IDeviceOperator|GetGameCardAsicInfo]].
 +
 +
== ChallengeCardExistence ==
 +
Signals the Gamecard ASIC to exchange random values with the current Gamecard. The Gamecard response values are returned in a 0x58 sized buffer while the host values are passed in the actual [[#OperationBuffer]] as follows.
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0
 +
| 0x1
 +
| Gamecard ASIC operation command (0x14)
 +
|-
 +
| 0x1
 +
| 0x1F
 +
| Random value from host
 +
|-
 +
| 0x20
 +
| 0x20
 +
| Command verification value
 +
|}
    
= Gamecard commands =
 
= Gamecard commands =
Line 374: Line 399:  
|-
 
|-
 
| 0x10
 
| 0x10
| [[#ReadId1Normal, ReadId1Secure, ReadId1Writer|#ReadId1Writer]]
+
| [[#ReadId1|ReadId1Write]]
 
|-
 
|-
 
| 0x11
 
| 0x11
| [[#ReadId2Normal, ReadId2Secure, ReadId2Writer|#ReadId2Writer]]
+
| [[#ReadId2|ReadId2Write]]
 
|-
 
|-
 
| 0x12
 
| 0x12
| [[#ReadId3Normal, ReadId3Secure, ReadId3Writer|#ReadId3Writer]]
+
| [[#ReadId3|ReadId3Write]]
 
|-
 
|-
 
| 0x15
 
| 0x15
| [[#ReadCrc]]
+
| [[#ReadCrc|ReadCrc]]
 
|-
 
|-
 
| 0x16
 
| 0x16
| [[#WritePage, WritePageSecure|#WritePage]]
+
| [[#WritePage|WritePage]]
 
|-
 
|-
 
| 0x18
 
| 0x18
| [[#Erase]]
+
| [[#Erase|Erase]]
 
|-
 
|-
 
| 0x19
 
| 0x19
| [[#ReadDevParam]]
+
| [[#ReadParameter|ReadParameter]]
 
|-
 
|-
 
| 0x20
 
| 0x20
| [[#WriteDevParam]]
+
| [[#WriteParameter|WriteParameter]]
 
|-
 
|-
 
| 0x21
 
| 0x21
| [[#ReadPage, ReadPageSecure|#ReadPageSecure]]
+
| [[#ReadPage|ReadPageSecure]]
 
|-
 
|-
 
| 0x28
 
| 0x28
| [[#ReadId2Normal, ReadId2Secure, ReadId2Writer|#ReadId2Normal]]
+
| [[#ReadId2|ReadId2]]
 
|-
 
|-
 
| 0x2E
 
| 0x2E
| [[#UnlockForceErase]]
+
| [2.0.0+] [[#ChangeDebugDirect|ChangeDebugDirect]]
 
|-
 
|-
 
| 0x30
 
| 0x30
| [[#ReadId3Normal, ReadId3Secure, ReadId3Writer|#ReadId3Secure]]
+
| [[#ReadId3|ReadId3Secure]]
 
|-
 
|-
 
| 0x39
 
| 0x39
| [[#UpdateKey]]
+
| [[#SetKey|SetKey]]
 
|-
 
|-
 
| 0x56
 
| 0x56
| [[#ReadId1Normal, ReadId1Secure, ReadId1Writer|#ReadId1Normal]]
+
| [[#ReadId1|ReadId1]]
 
|-
 
|-
 
| 0x83
 
| 0x83
| [[#WritePage, WritePageSecure|#WritePageSecure]]
+
| [[#WritePage|WritePageSecure]]
 
|-
 
|-
 
| 0x5B
 
| 0x5B
| [[#ReadPage, ReadPageSecure|#ReadPage]]
+
| [[#ReadPage|ReadPage]]
 
|-
 
|-
 
| 0x67
 
| 0x67
| [[#ReadId1Normal, ReadId1Secure, ReadId1Writer|#ReadId1Secure]]
+
| [[#ReadId1|ReadId1Secure]]
 
|-
 
|-
 
| 0xA5
 
| 0xA5
| [[#ReadId3Normal, ReadId3Secure, ReadId3Writer|#ReadId3Normal]]
+
| [[#ReadId3|ReadId3]]
 
|-
 
|-
 
| 0xB8
 
| 0xB8
| [[#Refresh]]
+
| [[#Refresh|Refresh]]
 
|-
 
|-
 
| 0xC4
 
| 0xC4
| [[#ReadId2Normal, ReadId2Secure, ReadId2Writer|#ReadId2Secure]]
+
| [[#ReadId2|ReadId2Secure]]
 
|-
 
|-
 
| 0xE0
 
| 0xE0
Line 437: Line 462:  
|-
 
|-
 
| 0xE2
 
| 0xE2
| EnterSecureMode
+
| ChangeInitialData
 
|}
 
|}
   −
== ReadId1Normal, ReadId1Secure, ReadId1Writer ==
+
== ReadId1 ==
 
Returns the Gamecard ID1 under one of the valid [[#Gamecard modes|Gamecard modes]].
 
Returns the Gamecard ID1 under one of the valid [[#Gamecard modes|Gamecard modes]].
   Line 496: Line 521:  
|}
 
|}
   −
== ReadId2Normal, ReadId2Secure, ReadId2Writer ==
+
== ReadId2 ==
 
Returns the Gamecard ID2 under one of the valid [[#Gamecard modes|Gamecard modes]].
 
Returns the Gamecard ID2 under one of the valid [[#Gamecard modes|Gamecard modes]].
   Line 552: Line 577:  
|}
 
|}
   −
== ReadId3Normal, ReadId3Secure, ReadId3Writer ==
+
== ReadId3 ==
 
Returns the Gamecard ID3 under one of the valid [[#Gamecard modes|Gamecard modes]].
 
Returns the Gamecard ID3 under one of the valid [[#Gamecard modes|Gamecard modes]].
   Line 660: Line 685:  
|}
 
|}
   −
== WritePage, WritePageSecure ==
+
== WritePage ==
 
Writes Gamecard pages. This command is only available in [[#Gamecard modes|Write]] and [[#Gamecard modes|Secure]] modes.
 
Writes Gamecard pages. This command is only available in [[#Gamecard modes|Write]] and [[#Gamecard modes|Secure]] modes.
   Line 712: Line 737:  
|}
 
|}
   −
== ReadPage, ReadPageSecure ==
+
== ReadPage ==
 
Reads Gamecard pages. This command is only available in [[#Gamecard modes|Normal]] and [[#Gamecard modes|Secure]] modes.
 
Reads Gamecard pages. This command is only available in [[#Gamecard modes|Normal]] and [[#Gamecard modes|Secure]] modes.
   Line 820: Line 845:  
|}
 
|}
   −
== ReadDevParam ==
+
== ReadParameter ==
 
Reads a development Gamecard's parameters. This command is only available in [[#Gamecard modes|Write]] mode.
 
Reads a development Gamecard's parameters. This command is only available in [[#Gamecard modes|Write]] mode.
   Line 876: Line 901:  
|}
 
|}
   −
== WriteDevParam ==
+
== WriteParameter ==
 
Writes a development Gamecard's parameters. This command is only available in [[#Gamecard modes|Write]] mode.
 
Writes a development Gamecard's parameters. This command is only available in [[#Gamecard modes|Write]] mode.
   Line 932: Line 957:  
|}
 
|}
   −
== UpdateKey ==
+
== SetKey ==
Updates the Gamecard's internal key data. This command is only available in [[#Gamecard modes|Secure]] mode.
+
Sets the Gamecard's internal key data. This command is only available in [[#Gamecard modes|Secure]] mode.
    
The [[#OperationBuffer]] is as follows.
 
The [[#OperationBuffer]] is as follows.
Line 1,044: Line 1,069:  
|}
 
|}
   −
== UnlockForceErase ==
+
== ChangeDebugDirect ==
 
Used by [[Filesystem_services#OpenGameCardStorage|OpenGameCardStorage]]. This command is only available in [[#Gamecard modes|Normal]] mode.
 
Used by [[Filesystem_services#OpenGameCardStorage|OpenGameCardStorage]]. This command is only available in [[#Gamecard modes|Normal]] mode.
   Line 1,158: Line 1,183:  
| 0x110
 
| 0x110
 
| 0x4
 
| 0x4
| Version (0, 1 or 3)
+
| Version (0, 0x1, [4.0.0+] 0x3, [9.0.0+] 0x7, [11.0.0+] 0xF, [12.0.0+] 0x1F)
 
|-
 
|-
 
| 0x114
 
| 0x114
Line 1,192: Line 1,217:  
Depending on it's purpose, multiple user firmware blobs exist.
 
Depending on it's purpose, multiple user firmware blobs exist.
   −
=== FwRead ===
+
=== ReadFw ===
 
Code for reading retail Gamecards. Only the normal and secure [[#Gamecard modes|Gamecard modes]] are supported.
 
Code for reading retail Gamecards. Only the normal and secure [[#Gamecard modes|Gamecard modes]] are supported.
   Line 1,199: Line 1,224:  
[4.0.0+] This firmware blob was updated to provide support for new Gamecards.
 
[4.0.0+] This firmware blob was updated to provide support for new Gamecards.
   −
=== FwWriter ===
+
[9.0.0+] This firmware blob was updated.
 +
 
 +
[11.0.0+] This firmware blob was updated.
 +
 
 +
[12.0.0+] This firmware blob was updated.
 +
 
 +
[14.0.0+] This firmware blob was updated.
 +
 
 +
=== WriterFw ===
 
Code for writing development Gamecards. Only the normal and write [[#Gamecard modes|Gamecard modes]] are supported.
 
Code for writing development Gamecards. Only the normal and write [[#Gamecard modes|Gamecard modes]] are supported.
    
Found inside [[Filesystem_services|FS]].
 
Found inside [[Filesystem_services|FS]].
   −
=== FwReadDev ===
+
=== ReadDevFw ===
 
Code for reading development Gamecards. Development Gamecards use common [[Gamecard_Format#Initial_Data|initial data]] which justifies the need for a specialized read firmware.
 
Code for reading development Gamecards. Development Gamecards use common [[Gamecard_Format#Initial_Data|initial data]] which justifies the need for a specialized read firmware.
    
Found inside [[Filesystem_services|FS]].
 
Found inside [[Filesystem_services|FS]].
   −
=== FwDebug ===
+
[9.0.0+] This firmware blob was updated.
Code for calling [[#GetRmaInformation]]. Must be passed as an argument for [[Filesystem_services#IDeviceOperator|GetGameCardAsicInfo]].
+
 
 +
[11.0.0+] This firmware blob was updated.
 +
 
 +
[14.0.0+] This firmware blob was updated.
 +
 
 +
=== RmaFw ===
 +
Code for calling [[#ReadRmaInformation]]. Must be passed as an argument for [[Filesystem_services#IDeviceOperator|GetGameCardAsicInfo]].
    
Never observed (possibly factory only).
 
Never observed (possibly factory only).
Line 1,216: Line 1,255:  
== Anti-downgrade ==
 
== Anti-downgrade ==
 
Loading an user firmware blob with a certain version field will lock the Gamecard ASIC to only allow running firmware blobs with the same or higher version number. Therefore, it is speculated that the Gamecard ASIC contains some sort of non-volatile memory bank which could be used for this purpose (among others).
 
Loading an user firmware blob with a certain version field will lock the Gamecard ASIC to only allow running firmware blobs with the same or higher version number. Therefore, it is speculated that the Gamecard ASIC contains some sort of non-volatile memory bank which could be used for this purpose (among others).
  −
The [[#FwWriter|FwWriter]] and [[#FwReadDev|FwReadDev]] blobs' version is always 0, but [[#FwRead|FwRead]] blob's version is either 1 or 3 ([4.0.0+]). This effectively locks retail consoles from using the development firmware blobs.
 

Navigation menu