暫定ファームフォーマットと実験用パラメータ

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_firmware@288 b871894f-2f95-9b40-918c-086798483c85
This commit is contained in:
yutaka 2009-02-13 01:58:33 +00:00
parent 4bd11995f1
commit adbd5a43a4
2 changed files with 189 additions and 0 deletions

View File

@ -0,0 +1,90 @@
/*---------------------------------------------------------------------------*
Project: ctr_firmware - format
File: firm.h
Copyright 2009 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#ifndef FORMAT_FIRM_H_
#define FORMAT_FIRM_H_
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*
* FIRM FORMAT
*===========================================================================*/
/*---------------------------------------------------------------------------*
*
*---------------------------------------------------------------------------*/
#define FIRM_FORMAT_HASH_LENGTH 32 // SHA-256 or HMAC-SHA-256
#define FIRM_FORMAT_SIGN_LENGTH 256 // RSA-2048 with PKCS#1 v1.5
#define FIRM_FORMAT_MAX_MODULES 4
#define FIRM_FORMAT_MAGIC_NUMBER ( 'F'<<0 | 'I'<<8 | 'R'<<16 | 'M'<<24 )
#define FIRM_FORMAT_FIRST_VIRSION 0
/*
CTRファームは特定のパーティション1つに1つ含めることができる
(: 0x10001)
*/
typedef struct FirmHash
{
u8 raw[FIRM_FORMAT_HASH_LENGTH];
}
FirmHash;
typedef struct FirmSign
{
u8 raw[FIRM_FORMAT_SIGN_LENGTH];
}
FirmSign;
typedef struct FirmModule
{
u32 sourceOffset; // FirmHeaderの先頭からのオフセット (512B境界に整列)
void* destinationAddress; // ARM9からみた転送先アドレス
u32 length; // 転送バイト数
BOOL isDMAC2; // 転送チェーンの最後にA9-DMAC1とA9-DMAC2のどちらを使うか
FirmHash hash; // データのハッシュ値 (ここはHMAC-SHA-256)
}
FirmModule;
typedef struct FirmHeaderCore
{
u32 magicNumber;
u32 versionNumber;
u32 entryAddressForMPCore; // modules対象番地以外はエラー (MPCoreにPIF経由で通知する)
u32 entryAddressForARM9; // A9-WRAM内、かつmodules対象番地以外はエラー
u8 padding[48]; // modulesに加えても良いが保険で空けておく
FirmModule modules[FIRM_FORMAT_MAX_MODULES]; // 何番目をどこにおいても自由 (A9-WRAMが最後?)
}
FirmHeaderCore;
typedef struct FirmHeder
{
FirmHeaderCore c; // ヘッダ本体
FirmSign sign; // FirmHeaderCoreの署名 (ここはSHA-256)
}
FirmHeader;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif // FORMAT_FIRM_H_

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*
Project: ctr_firmware - format
File: firmDummy.h
Copyright 2009 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Date:: $
$Rev$
$Author$
*---------------------------------------------------------------------------*/
#ifndef FORMAT_FIRM_DUMMY_H_
#define FORMAT_FIRM_DUMMY_H_
#ifdef __cplusplus
extern "C" {
#endif
/*===========================================================================*
* FIRM PARAMETERS
*===========================================================================*/
/*---------------------------------------------------------------------------*
*
*---------------------------------------------------------------------------*/
#define FIRM_FORMAT_NAND_HEADER_OFFSET 0x1000
#define FIRM_FORMAT_NAND_AES_KEY { \ // SEED/IDは使わない
0x2d, 0xde, 0x7a, 0x57, 0x9b, 0xe2, 0xf0, 0x37, 0x9d, 0xa9, 0x35, 0xbe, 0x83, 0x33, 0x15, 0x95 \
}
#define FIRM_FORMAT_NAND_AES_COUNTER { \ // オフセット0での値
0xbe, 0x30, 0x61, 0x15, 0xb0, 0x38, 0x27, 0x45, 0x20, 0x25, 0x72, 0x54, 0x28, 0x4e, 0x1f, 0x20 \
}
#define FIRM_FORMAT_HMAC_KEY { \ //
0xbc, 0xef, 0xb3, 0xc8, 0x71, 0x2c, 0xd3, 0x89, 0xaa, 0x30, 0xb9, 0x07, 0x64, 0x1d, 0xa3, 0x7d, \
0x6a, 0x50, 0x5e, 0x73, 0xbc, 0x32, 0xa5, 0xb0, 0x91, 0xd3, 0xcb, 0xc3, 0xef, 0x03, 0xc7, 0xa1, \
0xb3, 0xee, 0x52, 0xac, 0x4a, 0x54, 0x6e, 0x0d, 0x5e, 0x21, 0xcf, 0x0a, 0xd1, 0x00, 0xb3, 0x60, \
0xe2, 0x5e, 0xa2, 0xe8, 0x26, 0x16, 0xc3, 0xb0, 0x9e, 0x1b, 0xbd, 0x1a, 0x85, 0x03, 0xca, 0xe8 \
}
#define FIRM_FORMAT_RSA_PRIVATE_EXPONENT { \ // ビッグエンディアンなので注意!
0x12, 0x7e, 0xea, 0x6a, 0x61, 0x33, 0x9e, 0x62, 0xdf, 0xd2, 0x85, 0xa8, 0x19, 0x01, 0x7f, \
0x60, 0xda, 0x76, 0x76, 0xbf, 0x03, 0xec, 0xdb, 0x0d, 0x91, 0xad, 0x42, 0x63, 0x55, 0x1b, \
0x2f, 0x18, 0xcb, 0x6c, 0x4b, 0x5b, 0xb4, 0x3c, 0x92, 0x18, 0x88, 0x9f, 0xea, 0x43, 0x5f, \
0x3d, 0xa2, 0x5f, 0x2e, 0x89, 0x82, 0xf9, 0x82, 0x93, 0x13, 0x25, 0xe0, 0x86, 0x2f, 0x0c, \
0xe6, 0x13, 0x61, 0x31, 0x10, 0xfd, 0xf1, 0xfc, 0x03, 0x7b, 0x92, 0xfb, 0x03, 0xb5, 0x02, \
0xc2, 0xb8, 0x5b, 0xa4, 0x59, 0x8b, 0x08, 0x1f, 0x25, 0xdf, 0x32, 0x9f, 0xed, 0x95, 0xf9, \
0xce, 0x05, 0x5f, 0x42, 0x0e, 0x4d, 0x3f, 0x7f, 0xc5, 0x88, 0x54, 0x39, 0x5b, 0x37, 0x9e, \
0x8a, 0x0e, 0x30, 0x6e, 0xea, 0x2e, 0xa2, 0xe6, 0x35, 0x61, 0xb0, 0x6e, 0xa2, 0x66, 0x45, \
0xc6, 0x2a, 0xe3, 0x79, 0xb1, 0xcb, 0xcd, 0x9a, 0x8d, 0x76, 0x43, 0x32, 0x50, 0x2d, 0x35, \
0x42, 0x60, 0xcb, 0x26, 0x4f, 0x54, 0x80, 0xb3, 0xc0, 0xb8, 0xd3, 0xb3, 0x09, 0x07, 0x98, \
0xe0, 0x9c, 0xd8, 0x62, 0xcb, 0x2b, 0xca, 0x4f, 0x28, 0xd6, 0x22, 0x04, 0xba, 0x5a, 0x3e, \
0xb4, 0xcd, 0xf3, 0xa8, 0x8a, 0x37, 0xe7, 0x1a, 0x1d, 0x7f, 0x2f, 0x61, 0xe1, 0x55, 0x6f, \
0xb3, 0xf4, 0xe8, 0x63, 0xea, 0xd5, 0xfd, 0x17, 0x05, 0xca, 0x4d, 0x6d, 0xfe, 0x1c, 0x28, \
0x3f, 0x13, 0xe5, 0xfb, 0x5b, 0xbb, 0x1b, 0x04, 0x39, 0xe5, 0x4d, 0x4d, 0x9d, 0x44, 0x75, \
0xd7, 0xe0, 0x7b, 0xbc, 0x00, 0x6b, 0x88, 0x09, 0x64, 0x5d, 0x25, 0x25, 0x50, 0x12, 0x80, \
0x5c, 0x34, 0xcb, 0xb7, 0xe9, 0xbd, 0x58, 0x8c, 0xd2, 0xbe, 0xe3, 0x8f, 0x2b, 0x34, 0x0b, \
0xd8, 0x45, 0xdb, 0x02, 0xe8, 0x50, 0xf6, 0xb2, 0xd2, 0x02, 0xdd, 0xb9, 0x1e, 0x9e, 0xfa, \
0x99 \
}
#define FIRM_FORMAT_RSA_PUBLIC_EXPONENT 0x10001 // リトルエンディアン
#define FIRM_FORMAT_RSA_MODULUS { \ // ビッグエンディアン
0xb3, 0xec, 0xe2, 0x11, 0x63, 0x98, 0x79, 0x8a, 0x35, 0xef, 0x90, 0x88, 0xbe, 0xf7, \
0xd8, 0x44, 0x2a, 0x13, 0xba, 0xbe, 0xee, 0xdb, 0x85, 0x20, 0x84, 0x58, 0x29, 0x0f, 0xc0, \
0x1a, 0xe9, 0x3c, 0xdb, 0x38, 0x61, 0xe2, 0xb9, 0xac, 0x91, 0x0b, 0xeb, 0xcd, 0x30, 0xe0, \
0xb5, 0x37, 0xce, 0x54, 0x03, 0x37, 0xe0, 0xcd, 0xb5, 0xc5, 0x9f, 0x71, 0x43, 0x4c, 0x79, \
0xdd, 0xc4, 0x81, 0x04, 0x63, 0x08, 0x5c, 0x39, 0x12, 0xb6, 0x9b, 0xa9, 0x75, 0xdc, 0x82, \
0x81, 0xb7, 0xff, 0x06, 0x99, 0xca, 0x18, 0x00, 0xb0, 0xd8, 0xfc, 0xf0, 0xe1, 0x92, 0x1a, \
0x59, 0x25, 0x52, 0x64, 0x86, 0x1e, 0xc0, 0xb9, 0x52, 0x89, 0x07, 0x53, 0x17, 0x93, 0x82, \
0xf9, 0x43, 0x05, 0x26, 0x00, 0xc8, 0x8a, 0xd0, 0x57, 0xdd, 0x57, 0x46, 0xe1, 0x71, 0x3b, \
0xda, 0xed, 0xf9, 0xc1, 0x2b, 0xef, 0xf1, 0xfe, 0x59, 0x1f, 0xe2, 0x48, 0x27, 0xf9, 0xad, \
0x03, 0x8d, 0x79, 0xf5, 0xdd, 0x1a, 0xab, 0xdc, 0xe2, 0x67, 0x23, 0xb5, 0xee, 0x7d, 0xce, \
0x6d, 0xc9, 0x25, 0x02, 0x09, 0x48, 0x86, 0x5f, 0xf3, 0xd7, 0xb6, 0x54, 0xe1, 0x45, 0x1a, \
0xab, 0x17, 0x93, 0x7b, 0x55, 0xdb, 0x2b, 0x4e, 0x6c, 0xd8, 0x2b, 0x48, 0x18, 0x52, 0xc1, \
0x62, 0x7a, 0x14, 0xc2, 0xcd, 0x26, 0x3d, 0xd3, 0x33, 0xa8, 0x90, 0x5c, 0xde, 0xfc, 0x1e, \
0x99, 0x18, 0xc9, 0xb3, 0x4c, 0x47, 0xdd, 0x6a, 0x44, 0xd5, 0xcc, 0xa6, 0x67, 0x78, 0x86, \
0xd5, 0xb0, 0xa4, 0x9a, 0x2d, 0x0e, 0x43, 0x19, 0xb7, 0x4a, 0x83, 0xeb, 0x0a, 0x4a, 0x71, \
0xb5, 0x4b, 0x68, 0xd8, 0xc0, 0x4c, 0x05, 0x15, 0xee, 0xe8, 0x95, 0x1c, 0xb2, 0x50, 0xdc, \
0x7a, 0x08, 0xf1, 0xea, 0xa6, 0x5a, 0x5f, 0x3e, 0xa5, 0xe3, 0xf9, 0x09, 0x7f, 0x72, 0x78, \
0x5c, 0xaf \
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif // FORMAT_FIRM_DUMMY_H_