Difference between revisions of "SHA Registers"

From 3dbrew
Jump to navigation Jump to search
 
(6 intermediate revisions by 3 users not shown)
Line 14: Line 14:
 
|-
 
|-
 
| style="background: green" | Yes
 
| style="background: green" | Yes
| [[#SHA_INPUTSZ|SHA_INPUTSZ]]
+
| [[#SHA_BLKCNT|SHA_BLKCNT]]
 
| 0x1000A004
 
| 0x1000A004
 
| 4
 
| 4
Line 26: Line 26:
 
|-
 
|-
 
| style="background: green" | Yes
 
| style="background: green" | Yes
| [[#SHA_IN|SHA_IN]]
+
| [[#SHA_FIFO|SHA_FIFO]]
 
| 0x1000A080
 
| 0x1000A080
 
| 0x40
 
| 0x40
Line 37: Line 37:
 
!  Description
 
!  Description
 
|-
 
|-
| 0-1
+
| 0
| 0=Hash ready, 1=Normal, 2=Final Round
+
| Start (1=enable/busy, 0=idle)
 +
|-
 +
| 1
 +
| Final round (1=enable/busy, 0=normal)
 
|-
 
|-
 
| 2
 
| 2
| ?
+
| Input DMA enable (1= enable, 0=disable)
 
|-
 
|-
 
| 3
 
| 3
| Output Endianess (0=Little endian, 1=Big endian)
+
| Output Endianess (0=little, 1=big)
 
|-
 
|-
 
| 4-5
 
| 4-5
Line 56: Line 59:
 
|-
 
|-
 
| 8
 
| 8
| Unknown. When set, the *entire* ARM9 hangs/crashes when attempting to read REG_SHA_IN.
+
| Clear FIFO? When set, the *entire* ARM9 hangs/crashes when attempting to read SHA_INFIFO.
 
|-
 
|-
 
| 9
 
| 9
| ?
+
| Enable FIFO (1=fifo, 0=write-only)
 
|-
 
|-
 
| 10
 
| 10
| ?
+
| Output DMA enable (1= enable, 0=disable)
 
|-
 
|-
 
| 16
 
| 16
| Enable
+
| ?
 
|-
 
|-
 
| 17
 
| 17
| 1 when FIFO expects read/write
+
| ?
 
|}
 
|}
  
== SHA_INPUTSZ ==
+
Bit 8 is used when boot9 chains eMMC reads with AES and SHA to to load, decrypt and verify FIRM partitions.
This reg contains the total size of the data written to REG_SHA_IN.
+
 
 +
== SHA_BLKCNT ==
 +
This reg contains the total size of the data written to REG_SHA_IN, this field is updated when performing hash-function final-round.
  
 
== SHA_HASH ==
 
== SHA_HASH ==
 
This reg contains the SHA* hash after the final round, and the internal state during normal rounds. It is possible to write the internal state using this register.
 
This reg contains the SHA* hash after the final round, and the internal state during normal rounds. It is possible to write the internal state using this register.
  
== SHA_IN ==
+
== SHA_FIFO ==
The data to be hashed must be written here. The data must be padded with 0x00s to align with the register size (if needed).
+
The data to be hashed must be written here. It does not matter what offset is written to.

Latest revision as of 20:44, 15 May 2019

Registers[edit]

Old3DS Name Address Width Used by
Yes SHA_CNT 0x1000A000 4 Boot9, Process9
Yes SHA_BLKCNT 0x1000A004 4 Process9
Yes SHA_HASH 0x1000A040 0x20 Process9
Yes SHA_FIFO 0x1000A080 0x40 Boot9, Process9

SHA_CNT[edit]

Bits Description
0 Start (1=enable/busy, 0=idle)
1 Final round (1=enable/busy, 0=normal)
2 Input DMA enable (1= enable, 0=disable)
3 Output Endianess (0=little, 1=big)
4-5 Mode (0=SHA256, 1=SHA224, 2=3=SHA1)
6 ?
7 ?
8 Clear FIFO? When set, the *entire* ARM9 hangs/crashes when attempting to read SHA_INFIFO.
9 Enable FIFO (1=fifo, 0=write-only)
10 Output DMA enable (1= enable, 0=disable)
16 ?
17 ?

Bit 8 is used when boot9 chains eMMC reads with AES and SHA to to load, decrypt and verify FIRM partitions.

SHA_BLKCNT[edit]

This reg contains the total size of the data written to REG_SHA_IN, this field is updated when performing hash-function final-round.

SHA_HASH[edit]

This reg contains the SHA* hash after the final round, and the internal state during normal rounds. It is possible to write the internal state using this register.

SHA_FIFO[edit]

The data to be hashed must be written here. It does not matter what offset is written to.