(更新:Akabane Jumpei)

・ARM9から渡されたDS互換Blowfishテーブルを使うように変更。
デフォルトでは、ビルドスイッチでローカルのBlowfishテーブルを使うようになっている。
ビルドスイッチ:USE_LOCAL_KEYTABLE (hotsw/ARM7/include/blowfish.hで定義)


git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@848 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
(no author) 2008-03-07 07:46:13 +00:00
parent 6a0631dddb
commit ed41e55df5
4 changed files with 14 additions and 7 deletions

View File

@ -34,9 +34,7 @@ SRCS = blowfish.c \
ds_blowfish_table.c \
dsCardCommon.c \
romEmulation.c \
customNDma.c \
# dsCardType1.c \
# dsCardType2.c \
customNDma.c
TARGET_LIB = libhotsw_sp$(TWL_LIBSUFFIX).a

View File

@ -21,10 +21,14 @@
extern "C" {
#endif
#define USE_LOCAL_KEYTABLE
/*************************************************************************/
#ifdef USE_LOCAL_KEYTABLE
// 初期化テーブル
extern const BLOWFISH_CTX GCDi_BlowfishInitTableDS;
#endif
// Function Prototype ------------------------------------------------------------------------
// Blowfish 初期化

View File

@ -18,7 +18,6 @@
// Function Prototype -------------------------------------------------------
static u32 F(const BLOWFISH_CTX *ctx, u32 x);
//static void GCDi_InitBlowfishKeyAndTableDS(BLOWFISH_CTX *ctx, u32 *keyBufp, s32 keyLen);
//*****************************************
//
@ -27,16 +26,22 @@ static u32 F(const BLOWFISH_CTX *ctx, u32 x);
//*****************************************
void GCDm_MakeBlowfishTableDS(CardBootData *cbd, s32 keyLen)
{
#ifdef USE_LOCAL_KEYTABLE
const BLOWFISH_CTX *blowfishInitTablep = &GCDi_BlowfishInitTableDS;
#endif
u32 blowfishedKey[2];
u8 *RomHeaderCtrlRsvB = cbd->pBootSegBuf->rh.s.ctrl_reserved_B;
u32 *RomHeaderGameCode = (u32 *)cbd->pBootSegBuf->rh.s.game_code;
u32 *keyBuf = cbd->keyBuf;
BLOWFISH_CTX *ctx = &cbd->keyTable;
MI_CpuCopy32((void *)blowfishInitTablep, (void *)ctx, sizeof(BLOWFISH_CTX));
#ifdef USE_LOCAL_KEYTABLE
MI_CpuCopyFast((void *)blowfishInitTablep, (void *)ctx, sizeof(BLOWFISH_CTX));
#else
MI_CpuCopyFast((void *)HW_WRAM_0_LTD, (void *)ctx, sizeof(BLOWFISH_CTX));
#endif
keyBuf[0] = *RomHeaderGameCode;
keyBuf[1] = *RomHeaderGameCode >> 1;
keyBuf[2] = *RomHeaderGameCode << 1;

View File

@ -13,7 +13,7 @@
#include <hotswTypes.h>
const BLOWFISH_CTX GCDi_BlowfishInitTableDS = {
const BLOWFISH_CTX GCDi_BlowfishInitTableDS ATTRIBUTE_ALIGN(4) = {
0x5f20d599, 0xb9f54457, 0xd9a4196e, 0x945a6a9e,
0xebf1aed8, 0x3ae27541, 0x32d08293, 0xd531ee33,
0x9a6157cc, 0x1ba20637, 0xf5723979, 0xbef6ae55,