Switch 2: BCH: Difference between revisions

From Nintendo Switch Brew
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 34: Line 34:
| 0xFE0 || 0x4 || Stage2NumBinaries
| 0xFE0 || 0x4 || Stage2NumBinaries
|-
|-
| 0xFE4 || 0x10 || Stage2EcidHash
| 0xFE4 || 0x100 || Duk
|-
| 0xFF4 || 0xF0 ||  
|-
|-
| 0x10E4 || 0x30C ||  
| 0x10E4 || 0x30C ||  
Line 59: Line 57:
|-
|-
| 0x1AA4 || 0x8 || Key7KdfLabel
| 0x1AA4 || 0x8 || Key7KdfLabel
|-
| 0x1AAC || 0x430 ||
|-
|-
| 0x1EE0 || 0x120 (0x90 * 2) || [[#NvStage1Component|Stage1Components]][2]
| 0x1EE0 || 0x120 (0x90 * 2) || [[#NvStage1Component|Stage1Components]][2]
Line 102: Line 102:
| 0x20 || 0x10 || DerStr
| 0x20 || 0x10 || DerStr
|-
|-
| 0x30 || 0x4 ||  
| 0x30 || 0x4 || Reserved
|-
|-
| 0x34 || 0xC || Iv
| 0x34 || 0xC || Iv
Line 140: Line 140:
| 0x18 || 0x4 ||  
| 0x18 || 0x4 ||  
|-
|-
| 0x1C || 0x4 ||  
| 0x1C || 0x4 || [[#Flags0|Flags0]]
|-
|-
| 0x20 || 0x4 ||  
| 0x20 || 0x4 || UncompressedBinaryLen
|-
|-
| 0x24 || 0x4 ||  
| 0x24 || 0x4 || [[#Flags1|Flags1]]
|-
|-
| 0x28 || 0x4 ||  
| 0x28 || 0x4 || CompressedBinaryLen
|-
|-
| 0x2C || 0x4 || Flags
| 0x2C || 0x4 || [[#Flags2|Flags2]]
|-
|-
| 0x30 || 0x10 || DerStr
| 0x30 || 0x10 || DerStr
|-
|-
| 0x40 || 0x4 ||  
| 0x40 || 0x4 || Reserved
|-
|-
| 0x44 || 0xC || Iv
| 0x44 || 0xC || Iv
Line 182: Line 182:


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


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 197: 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