TSEC: Difference between revisions
No edit summary |
better names |
||
Line 5: | Line 5: | ||
== Registers == | == Registers == | ||
The TSEC's MMIO space is divided as follows: | |||
* 0x54500000 to 0x54501000: THI (Tegra Host Interface) | |||
* 0x54501000 to 0x54501400: FALCON (Falcon microcontroller) | |||
* 0x54501400 to 0x54501500: SCP (Secure Co- | * 0x54501400 to 0x54501500: SCP (Secure Co-processor) | ||
* 0x54501500 to 0x54501600: | * 0x54501500 to 0x54501600: RND (Random Number Generator) | ||
* 0x54501600 to | * 0x54501600 to 0x54501680: TFBIF (Tegra Framebuffer Interface) | ||
* 0x54501700 to 0x54501800: BAR0 | * 0x54501680 to 0x54501700: CG (Clock Gate) | ||
* 0x54501800 to 0x54501900: TEGRA ( | * 0x54501700 to 0x54501800: BAR0 (HOST1X device DMA) | ||
* 0x54501800 to 0x54501900: TEGRA (Miscellaneous interfaces) | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 655: | Line 656: | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_SCP_CFG | ||
| 0x54501410 | | 0x54501410 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_SCP_CTL_SCP | ||
| 0x54501414 | | 0x54501414 | ||
| 0x04 | | 0x04 | ||
Line 667: | Line 668: | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_SCP_CTL_DBG | ||
| 0x5450141C | | 0x5450141C | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| [[# | | [[#TSEC_SCP_DBG0|TSEC_SCP_DBG0]] | ||
| 0x54501420 | | 0x54501420 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| [[# | | [[#TSEC_SCP_DBG1|TSEC_SCP_DBG1]] | ||
| 0x54501424 | | 0x54501424 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| [[# | | [[#TSEC_SCP_DBG2|TSEC_SCP_DBG2]] | ||
| 0x54501428 | | 0x54501428 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| [[# | | [[#TSEC_SCP_CMD|TSEC_SCP_CMD]] | ||
| 0x54501430 | | 0x54501430 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_SCP_STAT0 | ||
| 0x54501450 | | 0x54501450 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| [[# | | [[#TSEC_SCP_STAT1|TSEC_SCP_STAT1]] | ||
| 0x54501454 | | 0x54501454 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| [[# | | [[#TSEC_SCP_STAT2|TSEC_SCP_STAT2]] | ||
| 0x54501458 | | 0x54501458 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_SCP_RND_STAT0 | ||
| 0x54501470 | | 0x54501470 | ||
| 0x04 | |||
|- | |||
| TSEC_SCP_RND_STAT1 | |||
| 0x54501474 | |||
| 0x04 | | 0x04 | ||
|- | |- | ||
Line 715: | Line 720: | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_SCP_SEC_ERR | ||
| 0x54501494 | | 0x54501494 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| [[# | | [[#TSEC_SCP_CMD_ERR|TSEC_SCP_CMD_ERR]] | ||
| 0x54501498 | | 0x54501498 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_RND_CTL0 | ||
| 0x54501500 | | 0x54501500 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_RND_CTL1 | ||
| 0x54501504 | | 0x54501504 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_RND_CTL2 | ||
| 0x54501508 | | 0x54501508 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_RND_CTL3 | ||
| 0x5450150C | | 0x5450150C | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_RND_CTL4 | ||
| 0x54501510 | | 0x54501510 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_RND_CTL5 | ||
| 0x54501514 | | 0x54501514 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_RND_CTL6 | ||
| 0x54501518 | | 0x54501518 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_RND_CTL7 | ||
| 0x5450151C | | 0x5450151C | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_RND_CTL8 | ||
| 0x54501520 | | 0x54501520 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_RND_CTL9 | ||
| 0x54501524 | | 0x54501524 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_RND_CTL10 | ||
| 0x54501528 | | 0x54501528 | ||
| 0x04 | | 0x04 | ||
|- | |- | ||
| | | TSEC_RND_CTL11 | ||
| 0x5450152C | | 0x5450152C | ||
| 0x04 | | 0x04 | ||
Line 2,464: | Line 2,469: | ||
|- | |- | ||
| 20 | | 20 | ||
| Enable | | Enable the CMD interface | ||
|} | |} | ||
Line 2,473: | Line 2,478: | ||
|- | |- | ||
| 11 | | 11 | ||
| Enable | | Enable RND testing mode | ||
|- | |- | ||
| 12 | | 12 | ||
| Enable the | | Enable the RND interface | ||
|} | |} | ||
Line 2,494: | Line 2,499: | ||
|- | |- | ||
| 0 | | 0 | ||
| | | Enable lockdown mode | ||
|- | |- | ||
| 1 | | 1 | ||
| | | | ||
|- | |- | ||
| 2 | | 2 | ||
| | | | ||
|- | |- | ||
| 3 | | 3 | ||
| | | | ||
|- | |- | ||
| 4 | | 4 | ||
| | | Lock the SCP and RND | ||
|- | |- | ||
| 5 | | 5 | ||
| | | | ||
|- | |- | ||
| 6 | | 6 | ||
| | | | ||
|- | |- | ||
| 7 | | 7 | ||
| | | | ||
|} | |} | ||
Controls lockdown mode and can only be cleared in Heavy Secure mode. | |||
=== TSEC_SCP_CTL_PKEY === | === TSEC_SCP_CTL_PKEY === | ||
Line 2,532: | Line 2,537: | ||
|} | |} | ||
=== | === TSEC_SCP_DBG0 === | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Bits | ! Bits | ||
Line 2,549: | Line 2,554: | ||
Controls the last crypto sequence (cs0 or cs1) created. | Controls the last crypto sequence (cs0 or cs1) created. | ||
=== | === TSEC_SCP_DBG1 === | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Bits | ! Bits | ||
Line 2,566: | Line 2,571: | ||
Contains information on the last crypto sequence (cs0 or cs1) created. | Contains information on the last crypto sequence (cs0 or cs1) created. | ||
=== | === TSEC_SCP_DBG2 === | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Bits | ! Bits | ||
Line 2,583: | Line 2,588: | ||
Contains information on the last crypto sequence (cs0 or cs1) executed. | Contains information on the last crypto sequence (cs0 or cs1) executed. | ||
=== | === TSEC_SCP_CMD === | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Bits | ! Bits | ||
Line 2,623: | Line 2,628: | ||
|- | |- | ||
| 28 | | 28 | ||
| Set if the | | Set if the command is valid | ||
|- | |- | ||
| 31 | | 31 | ||
Line 2,629: | Line 2,634: | ||
|} | |} | ||
Contains information on the last crypto | Contains information on the last crypto command executed. | ||
=== | === TSEC_SCP_STAT1 === | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Bits | ! Bits | ||
Line 2,642: | Line 2,647: | ||
Contains information on the last authentication attempt. | Contains information on the last authentication attempt. | ||
=== | === TSEC_SCP_STAT2 === | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Bits | ! Bits | ||
Line 2,669: | Line 2,674: | ||
|- | |- | ||
| 0 | | 0 | ||
| | | RND ready | ||
|- | |- | ||
| 8 | | 8 | ||
| | | ACL error | ||
|- | |- | ||
| 12 | | 12 | ||
| | | SEC error | ||
|- | |- | ||
| 16 | | 16 | ||
| | | CMD error | ||
|- | |- | ||
| 20 | | 20 | ||
| | | Single step | ||
|- | |- | ||
| 24 | | 24 | ||
| | | | ||
|- | |- | ||
| 28 | | 28 | ||
| | | | ||
|} | |} | ||
Line 2,698: | Line 2,703: | ||
|- | |- | ||
| 0 | | 0 | ||
| | | RND ready | ||
|- | |- | ||
| 8 | | 8 | ||
| | | ACL error | ||
|- | |- | ||
| 12 | | 12 | ||
| | | SEC error | ||
|- | |- | ||
| 16 | | 16 | ||
| | | CMD error | ||
|- | |- | ||
| 20 | | 20 | ||
| | | Single step | ||
|- | |- | ||
| 24 | | 24 | ||
| | | | ||
|- | |- | ||
| 28 | | 28 | ||
| | | | ||
|} | |} | ||
Line 2,739: | Line 2,744: | ||
|} | |} | ||
Contains information on the status generated by the [[#TSEC_SCP_IRQSTAT| | Contains information on the status generated by the [[#TSEC_SCP_IRQSTAT|ACL error]] IRQ. | ||
=== | === TSEC_SCP_CMD_ERR === | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Bits | ! Bits | ||
Line 2,747: | Line 2,752: | ||
|- | |- | ||
| 0 | | 0 | ||
| Invalid | | Invalid command | ||
|- | |- | ||
| 4 | | 4 | ||
Line 2,768: | Line 2,773: | ||
|} | |} | ||
Contains information on crypto errors generated by the [[#TSEC_SCP_IRQSTAT| | Contains information on crypto errors generated by the [[#TSEC_SCP_IRQSTAT|CMD error]] IRQ. | ||
=== TSEC_TFBIF_CTL === | === TSEC_TFBIF_CTL === | ||
Line 3,140: | Line 3,145: | ||
==== Implementation ==== | ==== Implementation ==== | ||
Under certain circumstances, it is possible to observe [[#csigauth|csigauth]] being briefly written to [[# | Under certain circumstances, it is possible to observe [[#csigauth|csigauth]] being briefly written to [[#TSEC_SCP_CMD|TSEC_SCP_CMD]] as "csigauth $c4 $c6" while the opcodes in [[#TSEC_SCP_STAT2|TSEC_SCP_STAT2]] are set to "cxsin" and "csigauth", respectively. | ||
Via [[# | Via [[#TSEC_SCP_DBG0|TSEC_SCP_DBG0]] it can be observed that a 3-sized macro sequence is loaded into cs0 during a secure mode transition. | ||
=== Operations === | === Operations === | ||
Line 3,225: | Line 3,230: | ||
Executing this instruction only succeeds if the TRNG is enabled for the SCP, which requires taking the following steps: | Executing this instruction only succeeds if the TRNG is enabled for the SCP, which requires taking the following steps: | ||
* Write 0x7FFF to | * Write 0x7FFF to TSEC_RND_CTL0. | ||
* Write 0x3FF0000 to | * Write 0x3FF0000 to TSEC_RND_CTL1. | ||
* Write 0xFF00 to | * Write 0xFF00 to TSEC_RND_CTL11. | ||
* Write 0x1000 to [[#TSEC_SCP_CTL1|TSEC_SCP_CTL1]]. | * Write 0x1000 to [[#TSEC_SCP_CTL1|TSEC_SCP_CTL1]]. | ||