From 317a657116e46ed943bc1723d132870c5e4cbe25 Mon Sep 17 00:00:00 2001 From: kamikawa Date: Fri, 23 May 2008 10:33:46 +0000 Subject: [PATCH] =?UTF-8?q?HW=E3=82=BB=E3=82=AD=E3=83=A5=E3=82=A2=E6=83=85?= =?UTF-8?q?=E5=A0=B1=E3=82=92=E5=85=88=E3=80=81HW=E3=83=8E=E3=83=BC?= =?UTF-8?q?=E3=83=9E=E3=83=AB=E6=83=85=E5=A0=B1=E3=82=92=E5=BE=8C=E3=81=A7?= =?UTF-8?q?=E6=9B=B8=E3=81=8D=E8=BE=BC=E3=82=80=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E3=80=82=EF=BC=88=E7=A7=BB=E8=A1=8C=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E3=81=AA=E3=83=A6=E3=83=8B=E3=83=BC=E3=82=AFID?= =?UTF-8?q?=E6=96=B0=E8=A8=AD=E3=81=B8=E3=81=AE=E5=AF=BE=E5=BF=9C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1502 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- .../HWInfoWriter/ARM9/src/HWInfoWriter.c | 48 +++++++++---------- .../HWInfoWriter/ARM9/src/hwi.c | 36 ++++++-------- .../ARM9.TWL/src/process_hw_info.c | 14 +++--- .../SystemUpdater/ARM9.TWL/src/hw_info.c | 10 ++-- 4 files changed, 51 insertions(+), 57 deletions(-) diff --git a/build/systemMenu_tools/HWInfoWriter/ARM9/src/HWInfoWriter.c b/build/systemMenu_tools/HWInfoWriter/ARM9/src/HWInfoWriter.c index d0daf2aa..3cb0895b 100644 --- a/build/systemMenu_tools/HWInfoWriter/ARM9/src/HWInfoWriter.c +++ b/build/systemMenu_tools/HWInfoWriter/ARM9/src/HWInfoWriter.c @@ -193,23 +193,12 @@ void HWInfoWriterMain( void ) // HW情報全体のライト static void WriteHWInfoFile( u8 region, BOOL isDisableWireless ) { - static const u16 *pMsgNormalWriting = (const u16 *)L"Writing Normal File..."; static const u16 *pMsgSecureWriting = (const u16 *)L"Writing Secure File..."; + static const u16 *pMsgNormalWriting = (const u16 *)L"Writing Normal File..."; static const u16 *pMsgHWIDSignWriting = (const u16 *)L"Writing HWID Sign File..."; static const u16 *pMsgSucceeded = (const u16 *)L"Succeeded!"; static const u16 *pMsgFailed = (const u16 *)L"Failed!"; - // ------------------------------------- - // ノーマルファイルのライト - // ------------------------------------- - (void)PutStringUTF16( MSG_X * 8, MSG_Y * 8, TXT_COLOR_BLACK, pMsgNormalWriting ); - - if( HWI_WriteHWNormalInfoFile() ) { - (void)PutStringUTF16( ( MSG_X + 20 ) * 8, MSG_Y * 8, TXT_COLOR_BLUE, pMsgSucceeded ); - }else { - (void)PutStringUTF16( ( MSG_X + 20 ) * 8, MSG_Y * 8, TXT_COLOR_RED, pMsgFailed ); - } - // ------------------------------------- // セキュアファイルのライト // ------------------------------------- @@ -220,7 +209,18 @@ static void WriteHWInfoFile( u8 region, BOOL isDisableWireless ) }else { (void)PutStringUTF16( ( MSG_X + 20 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_RED, pMsgFailed ); } + + // ------------------------------------- + // ノーマルファイルのライト (移行可能なユニークIDのためセキュアファイルの後でライトする) + // ------------------------------------- + (void)PutStringUTF16( MSG_X * 8, MSG_Y * 8, TXT_COLOR_BLACK, pMsgNormalWriting ); + if( HWI_WriteHWNormalInfoFile() ) { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, MSG_Y * 8, TXT_COLOR_BLUE, pMsgSucceeded ); + }else { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, MSG_Y * 8, TXT_COLOR_RED, pMsgFailed ); + } + // ------------------------------------- // HWID署名ファイルのライト // ------------------------------------- @@ -248,22 +248,12 @@ static void WriteHWInfoFile( u8 region, BOOL isDisableWireless ) // HWInfoファイルの削除 static void DeleteHWInfoFile( void ) { - static const u16 *pMsgNormalDeleting = (const u16 *)L"Deleting Normal File..."; static const u16 *pMsgSecureDeleting = (const u16 *)L"Deteting Secure File..."; + static const u16 *pMsgNormalDeleting = (const u16 *)L"Deleting Normal File..."; static const u16 *pMsgHWIDSignDeleting = (const u16 *)L"Deteting HWID Sign File."; static const u16 *pMsgSucceeded = (const u16 *)L"Succeeded!"; static const u16 *pMsgFailed = (const u16 *)L"Failed!"; - // ------------------------------------- - // ノーマルファイルの削除 - // ------------------------------------- - (void)PutStringUTF16( MSG_X * 8, MSG_Y * 8, TXT_COLOR_BLACK, pMsgNormalDeleting ); - if( HWI_DeleteHWNormalInfoFile() ) { - (void)PutStringUTF16( ( MSG_X + 20 ) * 8, MSG_Y * 8, TXT_COLOR_BLUE, pMsgSucceeded ); - }else { - (void)PutStringUTF16( ( MSG_X + 20 ) * 8, MSG_Y * 8, TXT_COLOR_RED, pMsgFailed ); - } - // ------------------------------------- // セキュアファイルの削除 // ------------------------------------- @@ -273,7 +263,17 @@ static void DeleteHWInfoFile( void ) }else { (void)PutStringUTF16( ( MSG_X + 20 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_RED, pMsgFailed ); } - + + // ------------------------------------- + // ノーマルファイルの削除 + // ------------------------------------- + (void)PutStringUTF16( MSG_X * 8, MSG_Y * 8, TXT_COLOR_BLACK, pMsgNormalDeleting ); + if( HWI_DeleteHWNormalInfoFile() ) { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, MSG_Y * 8, TXT_COLOR_BLUE, pMsgSucceeded ); + }else { + (void)PutStringUTF16( ( MSG_X + 20 ) * 8, MSG_Y * 8, TXT_COLOR_RED, pMsgFailed ); + } + // ------------------------------------- // HWID署名ファイルの削除 // ------------------------------------- diff --git a/build/systemMenu_tools/HWInfoWriter/ARM9/src/hwi.c b/build/systemMenu_tools/HWInfoWriter/ARM9/src/hwi.c index 4548d98c..cba71a85 100644 --- a/build/systemMenu_tools/HWInfoWriter/ARM9/src/hwi.c +++ b/build/systemMenu_tools/HWInfoWriter/ARM9/src/hwi.c @@ -24,7 +24,7 @@ #include "hwi.h" // define data------------------------------------------ -#ifdef FIRM_USE_PRODUCT_KEYS // 鍵選択スイッチ +#ifdef FIRM_USE_PRODUCT_KEYS // 鍵選択スイッチ #define HWINFO_PRIVKEY_PATH "rom:key/private_HWInfo.der" // 製品用秘密鍵 #else #define HWINFO_PRIVKEY_PATH "rom:key/private_HWInfo_dev.der" // 開発用秘密鍵 @@ -197,7 +197,14 @@ static BOOL ReadHWInfoFile( void ) { LCFGReadResult retval; BOOL result = TRUE; - OSTick start = OS_GetTick(); + + retval = LCFGi_THW_ReadSecureInfo(); + if( retval == LCFG_TSF_READ_RESULT_SUCCEEDED ) { + OS_TPrintf( "HW Secure Info read succeeded.\n" ); + }else { + result = FALSE; + OS_TPrintf( "HW Secure Info read failed.\n" ); + } retval = LCFGi_THW_ReadNormalInfo(); if( retval == LCFG_TSF_READ_RESULT_SUCCEEDED ) { @@ -207,35 +214,22 @@ static BOOL ReadHWInfoFile( void ) OS_TPrintf( "HW Normal Info read failed.\n" ); } -// OS_TPrintf( "HW Normal Info read time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - start ) ); - - start = OS_GetTick(); - retval = LCFGi_THW_ReadSecureInfo(); - if( retval == LCFG_TSF_READ_RESULT_SUCCEEDED ) { - OS_TPrintf( "HW Secure Info read succeeded.\n" ); - }else { - result = FALSE; - OS_TPrintf( "HW Secure Info read failed.\n" ); - } -// OS_TPrintf( "HW Secure Info read time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - start ) ); - return result; } // HWInfoファイルのベリファイ static void VerifyHWInfo( void ) { - if( VerifyData( (const u8 *)LCFG_THW_GetNormalInfo(), (const u8 *)LCFG_THW_GetDefaultNormalInfo(), sizeof(LCFGTWLHWNormalInfo) ) ) { - OS_TPrintf( "HW normal Info verify succeeded.\n" ); - }else { - OS_TPrintf( "HW normal Info verify failed.\n" ); - } if( VerifyData( (const u8 *)LCFG_THW_GetSecureInfo(), (const u8 *)LCFG_THW_GetDefaultSecureInfo(), sizeof(LCFGTWLHWSecureInfo) ) ) { OS_TPrintf( "HW secure Info verify succeeded.\n" ); }else { OS_TPrintf( "HW secure Info verify failed.\n" ); } - + if( VerifyData( (const u8 *)LCFG_THW_GetNormalInfo(), (const u8 *)LCFG_THW_GetDefaultNormalInfo(), sizeof(LCFGTWLHWNormalInfo) ) ) { + OS_TPrintf( "HW normal Info verify succeeded.\n" ); + }else { + OS_TPrintf( "HW normal Info verify failed.\n" ); + } } // メモリ上のデータベリファイ @@ -270,7 +264,7 @@ BOOL HWI_ModifyLanguage( u8 region ) if (!ReadTWLSettings()) { result = FALSE; - OS_TPrintf( "HW Normal Info read failed.\n" ); + OS_TPrintf( "Read TWLSettings failed.\n" ); } if( langBitmap & ( 0x0001 << nowLanguage ) ) { diff --git a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_hw_info.c b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_hw_info.c index cb4bc908..e3a2c412 100644 --- a/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_hw_info.c +++ b/build/systemMenu_tools/NandInitializerRed/ARM9.TWL/src/process_hw_info.c @@ -284,28 +284,28 @@ void* HWInfoProcess2(void) BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff ) { - static const char *pMsgNormalWriting = "Writing Normal File..."; static const char *pMsgSecureWriting = "Writing Secure File..."; + static const char *pMsgNormalWriting = "Writing Normal File..."; static const char *pMsgSignWriting = "Writing Sign File..."; static const char *pMsgSucceeded = "Success!\n"; static const char *pMsgFailed = "Failed!\n"; u32 installedSoftBoxCount = 0; BOOL result = TRUE; - // ノーマルファイルのライト - kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgNormalWriting ); + // セキュアファイルのライト + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSecureWriting ); - if( HWI_WriteHWNormalInfoFile() ) { + if( HWI_WriteHWSecureInfoFile( region, NULL, wirelessForceOff ) ) { kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); }else { kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); result = FALSE; } - // セキュアファイルのライト - kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSecureWriting ); + // ノーマルファイルのライト(移行可能なユニークIDのためにセキュアファイルの後で書き込む) + kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgNormalWriting ); - if( HWI_WriteHWSecureInfoFile( region, NULL, wirelessForceOff ) ) { // とりあえず無線は有効で。 + if( HWI_WriteHWNormalInfoFile() ) { kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); }else { kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); diff --git a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/hw_info.c b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/hw_info.c index 8625d58b..ed50cbac 100644 --- a/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/hw_info.c +++ b/build/systemMenu_tools/SystemUpdater/ARM9.TWL/src/hw_info.c @@ -61,24 +61,24 @@ BOOL DeleteHWInfoFile( void ); BOOL WriteHWInfoFile( u8 region, BOOL wirelessForceOff ) { - static const char *pMsgNormalWriting = "Writing Normal File..."; static const char *pMsgSecureWriting = "Writing Secure File..."; + static const char *pMsgNormalWriting = "Writing Normal File..."; static const char *pMsgSignWriting = "Writing Sign File..."; static const char *pMsgSucceeded = "Success!\n"; static const char *pMsgFailed = "Failed!\n"; u32 installedSoftBoxCount = 0; BOOL result = TRUE; - // ノーマルファイルのライト - if( HWI_WriteHWNormalInfoFile() ) { + // セキュアファイルのライト + if( HWI_WriteHWSecureInfoFile( region, NULL, wirelessForceOff ) ) { // とりあえず無線は有効で。 // kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); }else { kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed ); result = FALSE; } - // セキュアファイルのライト - if( HWI_WriteHWSecureInfoFile( region, NULL, wirelessForceOff ) ) { // とりあえず無線は有効で。 + // ノーマルファイルのライト(移行可能なユニークIDのためにセキュアファイルの後で書き込む) + if( HWI_WriteHWNormalInfoFile() ) { // kamiFontPrintfConsoleEx(CONSOLE_ORANGE, pMsgSucceeded ); }else { kamiFontPrintfConsoleEx(CONSOLE_RED, pMsgFailed );