Switch 2: BCH: Difference between revisions

From Nintendo Switch Brew
Jump to navigation Jump to search
Created page with "= NvBootComponentHeader = {| class="wikitable" border="1" |- ! Offset ! Size ! Name ! Description |- | 0x0000 || 4 || HeaderMagic || |- | 0x0004 || 0x40 || OuterDigest || |- | style="background: orange" | Outer Section Begin | style="background: orange" | | style="background: orange" | | style="background: orange" | |- | 0x0044 || 0xC || Reserved || |- | 0x0050 || 0x40 || InnerDigest || |- | 0x0090 || 0x40 || Stage2Signature || |- | 0x0BA0..."
 
 
(4 intermediate revisions by the same user not shown)
Line 4: Line 4:
! Offset
! Offset
! Size
! Size
! Name
! Description
! Description
|-
|-
| 0x0000 || 4 || HeaderMagic ||
| 0x0 || 0x4 || HeaderMagic
|-
|-
| 0x0004 || 0x40 || OuterDigest ||
| 0x4 || 0x40 || OuterDigest
|-
|-
| style="background: orange" | Outer Section Begin
| style="background: red" | Outer Section Begin
| style="background: orange" |  
| style="background: red" |  
| style="background: orange" |  
| style="background: red" |  
| style="background: orange" |  
|-
| 0x44 || 0xC || Reserved
|-
|-
| 0x0044 || 0xC || Reserved ||
| 0x50 || 0x40 || InnerDigest
|-
|-
| 0x0050 || 0x40 || InnerDigest ||
| 0x90 || 0xB10 || [[#NvBootCryptoSignatures|Stage2Signature]]
|-
|-
| 0x0090 || 0x40 || [[#NvBootCryptoSignatures|Stage2Signature]] ||
| 0xBA0 || 0x180 || [[#NvPublicKeyParameters|Stage2Pcp]]
|-
|-
| 0x0BA0 || 0x180 || [[#NvPublicKeyParameters|Stage2Pcp]] || Pinned by fuses.
| 0xD20 || 0x2A0 ||
|-
|-
| style="background: orange" | Stage 2 Signed Section Begin  
| style="background: orange" | Stage 2 Signed Section Begin  
| style="background: orange" |  
| style="background: orange" |  
| style="background: orange" |  
| style="background: orange" |  
| style="background: orange" |
|-
|-
| 0x0FC0 || 16 || Salt2 || Random 16 bytes.
| 0xFC0 || 0x10 || Stage2Iv
|-
| 0xFD0 || 0x10 || Stage2Ecid
|-
| 0xFE0 || 0x4 || Stage2NumBinaries
|-
| 0xFE4 || 0x100 || Duk
|-
| 0x10E4 || 0x30C ||  
|-
|-
| 0x0FD0 || 16 || Stage2Ecid ||  
| 0x13F0 || 0x8 || BlDerStr (must match BlDerStr from [[Switch_2:_BCT#BRBCT|BRBCT]])
|-
|-
| 0x0FE0 || 4 || Stage2NumBinaries ||  
| 0x13F8 || 0x8 || FwDerStr
|-
|-
| 0x0FE4 || 0x100 || ? ||  
| 0x1400 || 0x500 (0xA0 *8) || [[#NvStage2Component|Stage2Components]][8]
|-
|-
| 0x13F0 || 8 || BrbctBinding || Must match BR-BCT+0x19B0.
| 0x1900 || 0x180 || Stage1Signature (always RSA-3072)
|-
|-
| 0x1400 || 8 * 0xA0 || [[#NvStage2Component|Stage2Components]][8] ||
| style="background: yellow" | Stage 1 Signed Section Begin
| style="background: yellow" |  
| style="background: yellow" |  
|-
|-
| 0x1900 || 0x180 || Stage1Signature || Always RSA-3072.
| 0x1A80 || 0x10 || Stage1Iv
|-
|-
| style="background: orange" | Stage 1 Signed Section Begin
| 0x1A90 || 0x10 || Stage1Ecid
| style="background: orange" |  
| style="background: orange" |
| style="background: orange" |  
|-
|-
| 0x1A80 || 16 || Salt3 ||
| 0x1AA0 || 0x4 || Stage1NumBinaries
|-
|-
| 0x1A90 || 16 || Stage1Ecid ||  
| 0x1AA4 || 0x8 || Key7KdfLabel
|-
|-
| 0x1AA0 || 4 || Stage1NumBinaries ||  
| 0x1AAC || 0x430 ||  
|-
|-
| 0x1AA4 || 8 || Key7KdfLabel ||  
| 0x1EE0 || 0x120 (0x90 * 2) || [[#NvStage1Component|Stage1Components]][2]
|-
|-
| 0x1EE0 || 1 * 0x90 || [[#NvStage1Component|Stage1Components]][1] ||
| style="background: yellow" | Stage 1 Signed Section End
| style="background: yellow" |  
| style="background: yellow" |  
|-
|-
| style="background: orange" | Outer Section End / Stage 2 Signed Section End / Stage 1 Signed Section End
| style="background: orange" | Stage 2 Signed Section End
| style="background: orange" |
| style="background: orange" |  
| style="background: orange" |  
| style="background: orange" |  
| style="background: orange" |  
|-
| style="background: red" | Outer Section End
| style="background: red" |
| style="background: red" |
|}
|}


Line 69: Line 80:
! Offset
! Offset
! Size
! Size
! Name
! Description
|-
|-
| style="background: orange" | AAD Section Start
| style="background: orange" | AAD Section Start
Line 75: Line 86:
| style="background: orange" |  
| style="background: orange" |  
|-
|-
| 0x0 || 4 || BinaryMagic
| 0x0 || 0x4 || BinaryMagic
|-
|-
| 0x4 || 4 || BinaryLen
| 0x4 || 0x4 || BinaryLen
|-
|-
| 0x8 || 4 || LoadDestination
| 0x8 || 0x4 || LoadDestination
|-
|-
| 0xC || 4 || EntryPoint
| 0xC || 0x4 || EntryPoint
|-
|-
| 0x10 || 4 || [[#NvBootComponentVersion|Version]]
| 0x10 || 0x4 || [[#NvBootComponentVersion|Version]]
|-
|-
| 0x14 || 4 || Reserved  
| 0x14 || 0x4 || Reserved  
|-
|-
| 0x18 || 8 || PartitionOffset (Only used for MEM-BCT)
| 0x18 || 0x8 || PartitionOffset (only used for MEM-BCT)
|-
|-
| 0x20 || 16 || KdfLabel
| 0x20 || 0x10 || DerStr
|-
|-
| 0x30 || 4 || Zeroes
| 0x30 || 0x4 || Reserved
|-
|-
| 0x34 || 12 || GcmIv
| 0x34 || 0xC || Iv
|-
|-
| style="background: orange" | AAD Section End
| style="background: orange" | AAD Section End
Line 99: Line 110:
| style="background: orange" |  
| style="background: orange" |  
|-
|-
| 0x40 || 16 || GcmAuthTag
| 0x40 || 0x10 || AuthTag
|-
|-
| 0x50 || 64 || PayloadDigest (SHA512 of 0x2000..)
| 0x50 || 0x40 || PayloadDigest (SHA512 of 0x2000..)
|}
|}


Line 109: Line 120:
! Offset
! Offset
! Size
! Size
! Name
! Description
|-
|-
| style="background: orange" | AAD Section Start
| style="background: orange" | AAD Section Start
Line 115: Line 126:
| style="background: orange" |  
| style="background: orange" |  
|-
|-
| 0x0 || 4 || BinaryMagic
| 0x0 || 0x4 || BinaryMagic
|-
| 0x4 || 0x4 || BinaryLen
|-
|-
| 0x4 || 4 || BinaryLen
| 0x8 || 0x4 || LoadDestination
|-
|-
| 0x8 || 4 || LoadDestination
| 0xC || 0x4 || EntryPoint
|-
|-
| 0xC || 4 || EntryPoint
| 0x10 || 0x4 || [[#NvBootComponentVersion|Version]]
|-
|-
| 0x10 || 4 || [[#NvBootComponentVersion|Version]]
| 0x14 || 0x4 ||  
|-
|-
| 0x24 || 0x1C || ?
| 0x18 || 0x4 ||  
|-
|-
| 0x30 || 16 || KdfLabel
| 0x1C || 0x4 || [[#Flags0|Flags0]]
|-
|-
| 0x40 || 4 || Zeroes
| 0x20 || 0x4 || UncompressedBinaryLen
|-
|-
| 0x44 || 12 || GcmIv
| 0x24 || 0x4 || [[#Flags1|Flags1]]
|-
| 0x28 || 0x4 || CompressedBinaryLen
|-
| 0x2C || 0x4 || [[#Flags2|Flags2]]
|-
| 0x30 || 0x10 || DerStr
|-
| 0x40 || 0x4 || Reserved
|-
| 0x44 || 0xC || Iv
|-
|-
| style="background: orange" | AAD Section End
| style="background: orange" | AAD Section End
Line 137: Line 160:
| style="background: orange" |  
| style="background: orange" |  
|-
|-
| 0x50 || 16 || GcmAuthTag
| 0x50 || 0x10 || AuthTag
|-
|-
| 0x60 || 64 || PayloadDigest (SHA512 of 0x2000..)
| 0x60 || 0x40 || PayloadDigest (SHA512 of 0x2000..)
|}
|}


Line 147: Line 170:
! Offset
! Offset
! Size
! Size
! Name
! Description
|-
|-
| 0x0 || 1 || Major
| 0x0 || 1 || Major
Line 159: Line 182:


== NvBootCryptoSignatures ==
== NvBootCryptoSignatures ==
This is a union.
This is an union.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 165: Line 188:
! Offset
! Offset
! Size
! Size
! Name
! Description
|-
|-
| 0x0 || 0x20 || Sha256Signature
| 0x0 || 0x20 || Sha256Signature
Line 174: Line 197:
|-
|-
| 0x0 || 0xB10 || XmssSignature
| 0x0 || 0xB10 || XmssSignature
|}
== NvPublicKeyParameters ==
This is an union.
{| class="wikitable" border="1"
|-
! Offset
! Size
! Description
|-
| 0x0 || 0x20 || Eddsa
|-
| 0x0 || 0x40 || Ecdsa
|-
| 0x0 || 0x180 || Rsa
|}
== Flags0 ==
{| class="wikitable" border="1"
!  Bits
!  Description
|-
| 0-25
|
|-
| 26
| IsEncrypted
|-
| 27
| IsCompressed
|-
| 28-31
|
|}
== Flags1 ==
{| class="wikitable" border="1"
!  Bits
!  Description
|-
| 0-23
|
|-
| 16-23
| BootImgType
|-
| 24-31
|
|}
== Flags2 ==
{| class="wikitable" border="1"
!  Bits
!  Description
|-
| 0-7
|
|-
| 8
| IsClassKeysSigned
|-
| 9-31
|
|}
|}

Latest revision as of 01:46, 3 October 2025

NvBootComponentHeader

Offset Size Description
0x0 0x4 HeaderMagic
0x4 0x40 OuterDigest
Outer Section Begin
0x44 0xC Reserved
0x50 0x40 InnerDigest
0x90 0xB10 Stage2Signature
0xBA0 0x180 Stage2Pcp
0xD20 0x2A0
Stage 2 Signed Section Begin
0xFC0 0x10 Stage2Iv
0xFD0 0x10 Stage2Ecid
0xFE0 0x4 Stage2NumBinaries
0xFE4 0x100 Duk
0x10E4 0x30C
0x13F0 0x8 BlDerStr (must match BlDerStr from BRBCT)
0x13F8 0x8 FwDerStr
0x1400 0x500 (0xA0 *8) Stage2Components[8]
0x1900 0x180 Stage1Signature (always RSA-3072)
Stage 1 Signed Section Begin
0x1A80 0x10 Stage1Iv
0x1A90 0x10 Stage1Ecid
0x1AA0 0x4 Stage1NumBinaries
0x1AA4 0x8 Key7KdfLabel
0x1AAC 0x430
0x1EE0 0x120 (0x90 * 2) Stage1Components[2]
Stage 1 Signed Section End
Stage 2 Signed Section End
Outer Section End

NvStage1Component

Offset Size Description
AAD Section Start
0x0 0x4 BinaryMagic
0x4 0x4 BinaryLen
0x8 0x4 LoadDestination
0xC 0x4 EntryPoint
0x10 0x4 Version
0x14 0x4 Reserved
0x18 0x8 PartitionOffset (only used for MEM-BCT)
0x20 0x10 DerStr
0x30 0x4 Reserved
0x34 0xC Iv
AAD Section End
0x40 0x10 AuthTag
0x50 0x40 PayloadDigest (SHA512 of 0x2000..)

NvStage2Component

Offset Size Description
AAD Section Start
0x0 0x4 BinaryMagic
0x4 0x4 BinaryLen
0x8 0x4 LoadDestination
0xC 0x4 EntryPoint
0x10 0x4 Version
0x14 0x4
0x18 0x4
0x1C 0x4 Flags0
0x20 0x4 UncompressedBinaryLen
0x24 0x4 Flags1
0x28 0x4 CompressedBinaryLen
0x2C 0x4 Flags2
0x30 0x10 DerStr
0x40 0x4 Reserved
0x44 0xC Iv
AAD Section End
0x50 0x10 AuthTag
0x60 0x40 PayloadDigest (SHA512 of 0x2000..)

NvBootComponentVersion

Offset Size Description
0x0 1 Major
0x1 1 Minor
0x2 1 Ratchet (others)
0x2 2 BigRatchet (NVDEC only)

NvBootCryptoSignatures

This is an union.

Offset Size Description
0x0 0x20 Sha256Signature
0x0 0x40 Sha512Signature
0x0 0x40 Rsa3072Signature
0x0 0xB10 XmssSignature

NvPublicKeyParameters

This is an union.

Offset Size Description
0x0 0x20 Eddsa
0x0 0x40 Ecdsa
0x0 0x180 Rsa

Flags0

Bits Description
0-25
26 IsEncrypted
27 IsCompressed
28-31

Flags1

Bits Description
0-23
16-23 BootImgType
24-31

Flags2

Bits Description
0-7
8 IsClassKeysSigned
9-31