mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
(更新:Akabane Jumpei)
・関数名の変更 ・いらない構造体メンバの削除 git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1107 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
parent
8b7a32631c
commit
ce1e0cbda0
@ -39,7 +39,7 @@ void EncryptByBlowfish(const BLOWFISH_CTX *ctx, u32 *xl, u32 *xr);
|
|||||||
void DecryptByBlowfish(const BLOWFISH_CTX *ctx, u32 *xl, u32 *xr);
|
void DecryptByBlowfish(const BLOWFISH_CTX *ctx, u32 *xl, u32 *xr);
|
||||||
|
|
||||||
// Key Table の生成
|
// Key Table の生成
|
||||||
void GCDm_MakeBlowfishTableDS(CardBootData *cbd, s32 keyLen);
|
void MakeBlowfishTableDS(CardBootData *cbd, s32 keyLen);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -327,18 +327,12 @@ typedef struct CardThreadData{
|
|||||||
} CardThreadData;
|
} CardThreadData;
|
||||||
|
|
||||||
// カード起動用関数
|
// カード起動用関数
|
||||||
typedef struct CardBootFunction {
|
typedef struct CardSecureModeFunction {
|
||||||
HotSwState (*ReadBootSegment_N)(CardBootData *cbd);
|
|
||||||
HotSwState (*ChangeMode_N)(CardBootData *cbd);
|
|
||||||
|
|
||||||
HotSwState (*ReadID_S)(CardBootData *cbd);
|
HotSwState (*ReadID_S)(CardBootData *cbd);
|
||||||
HotSwState (*ReadSegment_S)(CardBootData *cbd);
|
HotSwState (*ReadSegment_S)(CardBootData *cbd);
|
||||||
HotSwState (*SetPNG_S)(CardBootData *cbd);
|
HotSwState (*SetPNG_S)(CardBootData *cbd);
|
||||||
HotSwState (*ChangeMode_S)(CardBootData *cbd);
|
HotSwState (*ChangeMode_S)(CardBootData *cbd);
|
||||||
|
} CardSecureModeFunction;
|
||||||
HotSwState (*ReadID_G)(CardBootData *cbd);
|
|
||||||
HotSwState (*ReadPage_G)(CardBootData *cbd, u32 addr, void* buf, u32 size);
|
|
||||||
} CardBootFunction;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|||||||
@ -23,11 +23,11 @@ static u32 F(const BLOWFISH_CTX *ctx, u32 x);
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*
|
/*---------------------------------------------------------------------------*
|
||||||
Name: GCDm_MakeBlowfishTableDS
|
Name: MakeBlowfishTableDS
|
||||||
|
|
||||||
Description: KeyTable‚Ì<EFBFBD>¶<EFBFBD>¬
|
Description: KeyTable‚Ì<EFBFBD>¶<EFBFBD>¬
|
||||||
*---------------------------------------------------------------------------*/
|
*---------------------------------------------------------------------------*/
|
||||||
void GCDm_MakeBlowfishTableDS(CardBootData *cbd, s32 keyLen)
|
void MakeBlowfishTableDS(CardBootData *cbd, s32 keyLen)
|
||||||
{
|
{
|
||||||
const BLOWFISH_CTX *initTable = &HotSwBlowfishInitTableBufDS;
|
const BLOWFISH_CTX *initTable = &HotSwBlowfishInitTableBufDS;
|
||||||
|
|
||||||
|
|||||||
@ -150,23 +150,15 @@ static u8 s_digestDefaultKey[ DIGEST_HASH_BLOCK_SIZE_SHA1 ] = {
|
|||||||
0x87, 0x46, 0x58, 0x24
|
0x87, 0x46, 0x58, 0x24
|
||||||
};
|
};
|
||||||
|
|
||||||
static CardBootFunction s_funcTable[] = {
|
static CardSecureModeFunction s_funcTable[] = {
|
||||||
// DS Card Type 1
|
// DS Card Type 1
|
||||||
{ ReadBootSegNormal, ChangeModeNormal, // Normalモード関数
|
{ ReadIDSecure, ReadSegSecure, SwitchONPNGSecure, ChangeModeSecure},
|
||||||
ReadIDSecure, ReadSegSecure, SwitchONPNGSecure, ChangeModeSecure, // Secureモード関数
|
|
||||||
ReadIDGame, ReadPageGame}, // Game モード関数
|
|
||||||
// DS Card Type 2
|
// DS Card Type 2
|
||||||
{ ReadBootSegNormal, ChangeModeNormal, // Normalモード関数
|
{ ReadIDSecure, ReadSegSecure, SwitchONPNGSecure, ChangeModeSecure},
|
||||||
ReadIDSecure, ReadSegSecure, SwitchONPNGSecure, ChangeModeSecure, // Secureモード関数
|
|
||||||
ReadIDGame, ReadPageGame}, // Game モード関数
|
|
||||||
// TWL Card Type 1
|
// TWL Card Type 1
|
||||||
{ ReadBootSegNormal, ChangeModeNormal, // Normalモード関数
|
{ ReadIDSecure, ReadSegSecure, SwitchONPNGSecure, ChangeModeSecure},
|
||||||
ReadIDSecure, ReadSegSecure, SwitchONPNGSecure, ChangeModeSecure, // Secureモード関数
|
|
||||||
ReadIDGame, ReadPageGame}, // Game モード関数
|
|
||||||
// RomEmulation
|
// RomEmulation
|
||||||
{ ReadBootSegNormal, ChangeModeNormal, // Normalモード関数
|
{ReadIDSecure_ROMEMU, ReadSegSecure_ROMEMU, SwitchONPNGSecure_ROMEMU, ChangeModeSecure_ROMEMU}
|
||||||
ReadIDSecure_ROMEMU, ReadSegSecure_ROMEMU, SwitchONPNGSecure_ROMEMU, ChangeModeSecure_ROMEMU, // Secureモード関数
|
|
||||||
ReadIDGame, ReadPageGame}, // Game モード関数
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Global Values ------------------------------------------------------------
|
// Global Values ------------------------------------------------------------
|
||||||
@ -352,7 +344,7 @@ static HotSwState LoadCardData(void)
|
|||||||
LockHotSwRsc(&SYSMi_GetWork()->lockCardRsc);
|
LockHotSwRsc(&SYSMi_GetWork()->lockCardRsc);
|
||||||
|
|
||||||
// Boot Segment読み込み
|
// Boot Segment読み込み
|
||||||
state = s_funcTable[s_cbData.cardType].ReadBootSegment_N(&s_cbData);
|
state = ReadBootSegNormal(&s_cbData);
|
||||||
retval = (retval == HOTSW_SUCCESS) ? state : retval;
|
retval = (retval == HOTSW_SUCCESS) ? state : retval;
|
||||||
|
|
||||||
// ワンセグ差込み時はカードバス電源をディープスリープ(PFM)に入れない
|
// ワンセグ差込み時はカードバス電源をディープスリープ(PFM)に入れない
|
||||||
@ -420,7 +412,7 @@ static HotSwState LoadCardData(void)
|
|||||||
s_cbData.secureLatency = AddLatency2ToLatency1(s_cbData.pBootSegBuf->rh.s.secure_cmd_param);
|
s_cbData.secureLatency = AddLatency2ToLatency1(s_cbData.pBootSegBuf->rh.s.secure_cmd_param);
|
||||||
|
|
||||||
// Key Table初期化
|
// Key Table初期化
|
||||||
GCDm_MakeBlowfishTableDS(&s_cbData, 8);
|
MakeBlowfishTableDS(&s_cbData, 8);
|
||||||
|
|
||||||
// コマンド認証値・コマンドカウンタ初期値・PNジェネレータ初期値の生成
|
// コマンド認証値・コマンドカウンタ初期値・PNジェネレータ初期値の生成
|
||||||
GenVA_VB_VD();
|
GenVA_VB_VD();
|
||||||
@ -475,7 +467,7 @@ static HotSwState LoadCardData(void)
|
|||||||
retval = (retval == HOTSW_SUCCESS) ? state : retval;
|
retval = (retval == HOTSW_SUCCESS) ? state : retval;
|
||||||
|
|
||||||
// Key Table初期化
|
// Key Table初期化
|
||||||
GCDm_MakeBlowfishTableDS(&s_cbData, 8);
|
MakeBlowfishTableDS(&s_cbData, 8);
|
||||||
|
|
||||||
// コマンド認証値・コマンドカウンタ初期値・PNジェネレータ初期値の生成
|
// コマンド認証値・コマンドカウンタ初期値・PNジェネレータ初期値の生成
|
||||||
GenVA_VB_VD();
|
GenVA_VB_VD();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user