TwlIPL/build/systemMenu_RED/HWInfoWriter/ARM9/src/HWInfoWriter.c
yosiokat 05b6fa7d52 HWInfoWriter
ダミーシリアルNo.をちゃんと文字列になるよう修正。
 regionとserialNoを上画面に表示するよう変更。


git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@461 b08762b0-b915-fc4b-9d8c-17b2551a87ff
2008-01-15 04:33:46 +00:00

488 lines
14 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*---------------------------------------------------------------------------*
Project: TwlIPL
File: DS_Chat.c
Copyright 2007 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$
*---------------------------------------------------------------------------*/
#include <twl.h>
#include <sysmenu.h>
#include "misc.h"
#include "HWInfoWriter.h"
// define data------------------------------------------
#define WRITER_ELEMENT_NUM 7
#define MSG_X 3
#define MSG_Y 19
// extern data------------------------------------------
const TWLHWNormalInfo *THW_GetDefaultNormalInfo( void );
const TWLHWSecureInfo *THW_GetDefaultSecureInfo( void );
const TWLHWNormalInfo *THW_GetNormalInfo( void );
const TWLHWSecureInfo *THW_GetSecureInfo( void );
// function's prototype declaration---------------------
static void ReadTWLSettings( void );
static void ModifyLanguage( u8 region );
static void ReadPrivateKey( void );
static void ReadHWInfoFile( void );
static void WriteHWInfoFile( u8 region );
static BOOL WriteHWNormalInfoFile( void );
static BOOL WriteHWSecureInfoFile( u8 region );
static void DeleteHWInfoFile( void );
static void VerifyHWInfo( void );
static BOOL VerifyData( const u8 *pTgt, const u8 *pOrg, u32 len );
static void DispMessage( int x, int y, u16 color, const u16 *pMsg );
// global variable -------------------------------------
RTCDrawProperty g_rtcDraw = {
TRUE, RTC_DATE_TOP_X, RTC_DATE_TOP_Y, RTC_TIME_TOP_X, RTC_TIME_TOP_Y
};
// static variable -------------------------------------
static u16 s_csr;
static u8 *s_pPrivKeyBuffer = NULL;
static TSFReadResult (*s_pReadSecureInfoFunc)( void );
static BOOL s_isReadTSD;
static u8 s_region_old;
// const data -----------------------------------------
static const u16 *const s_pStrWriter[ WRITER_ELEMENT_NUM ] = {
(const u16 *)L"Write HW Info REGION=JAPAN",
(const u16 *)L"Write HW Info REGION=AMERICA",
(const u16 *)L"Write HW Info REGION=EUROPE",
(const u16 *)L"Write HW Info REGION=AUSTRALIA",
(const u16 *)L"Write HW Info REGION=CHINA",
(const u16 *)L"Write HW Info REGION=KOREA",
(const u16 *)L"Delete HW Info",
};
static MenuPos s_writerPos[] = {
{ TRUE, 3 * 8, 4 * 8 },
{ TRUE, 3 * 8, 6 * 8 },
{ TRUE, 3 * 8, 8 * 8 },
{ TRUE, 3 * 8, 10 * 8 },
{ TRUE, 3 * 8, 12 * 8 },
{ TRUE, 3 * 8, 14 * 8 },
{ TRUE, 3 * 8, 16 * 8 },
};
static const MenuParam s_writerParam = {
WRITER_ELEMENT_NUM,
TXT_COLOR_BLACK,
TXT_COLOR_GREEN,
TXT_COLOR_RED,
&s_writerPos[ 0 ],
(const u16 **)&s_pStrWriter,
};
static const u32 s_langBitmapList[ TWL_REGION_MAX ] = {
TWL_LANG_BITMAP_JAPAN,
TWL_LANG_BITMAP_AMERICA,
TWL_LANG_BITMAP_EUROPE,
TWL_LANG_BITMAP_AUSTRALIA,
TWL_LANG_BITMAP_CHINA,
TWL_LANG_BITMAP_KOREA,
};
static char *strLanguage[] = {
(char *)"LANG_JAPANESE",
(char *)"LANG_ENGLISH",
(char *)"LANG_FRENCH",
(char *)"LANG_GERMAN",
(char *)"LANG_ITALIAN",
(char *)"LANG_SPANISH",
(char *)"LANG_CHINESE",
(char *)"LANG_KOREAN",
};
static const char *strRegion[] = {
"JAPAN",
"AMERICA",
"EUROPE",
"AUSTRALIA",
"CHINA",
"KOREA",
};
//======================================================
// HW<48><57><EFBFBD>񃉃C<F1838983>^<5E>[
//======================================================
// HW<48><57><EFBFBD>񃉃C<F1838983>^<5E>[<5B>̏<EFBFBD><CC8F><EFBFBD><EFBFBD><EFBFBD>
void HWInfoWriterInit( void )
{
GX_DispOff();
GXS_DispOff();
InitBG();
NNS_G2dCharCanvasClear( &gCanvas, TXT_COLOR_WHITE );
PutStringUTF16( 1 * 8, 0 * 8, TXT_COLOR_BLUE, (const u16 *)L"HW Info Writer");
GetAndDrawRTCData( &g_rtcDraw, TRUE );
ACSign_SetAllocFunc( Alloc, Free );
ReadTWLSettings();
ReadPrivateKey();
ReadHWInfoFile();
// VerifyHWInfo();
OS_TPrintf( "region = %d\n", THW_GetRegion() );
PrintfSJISSub( 2 * 8, 18 * 8, TXT_COLOR_BLACK, "Region = %s", strRegion[ THW_GetRegion() ] );
PrintfSJISSub( 2 * 8, 20 * 8, TXT_COLOR_BLACK, "SerialNo = %s", THW_GetSerialNoPtr() );
s_region_old = THW_GetRegion();
s_csr = 0;
DrawMenu( s_csr, &s_writerParam );
GXS_SetVisiblePlane( GX_PLANEMASK_BG0 );
GX_DispOn();
GXS_DispOn();
}
// HW<48><57><EFBFBD>񃉃C<F1838983>^<5E>[<5B>̃<EFBFBD><CC83>C<EFBFBD><43><EFBFBD><EFBFBD><EFBFBD>[<5B>v
void HWInfoWriterMain( void )
{
// <20>J<EFBFBD>[<5B>\<5C><><EFBFBD>ړ<EFBFBD>
if( pad.trg & PAD_KEY_DOWN ){
if( ++s_csr == WRITER_ELEMENT_NUM ) {
s_csr = 0;
}
}
if( pad.trg & PAD_KEY_UP ){
if( --s_csr & 0x8000 ) {
s_csr = WRITER_ELEMENT_NUM - 1;
}
}
DrawMenu( s_csr, &s_writerParam );
// <20><><EFBFBD>s
if( pad.trg == PAD_BUTTON_A ) {
if( s_csr == WRITER_ELEMENT_NUM - 1 ) {
OS_TPrintf( "Delete start.\n" );
(void)DeleteHWInfoFile();
}else {
OS_TPrintf( "Write start.\n" );
WriteHWInfoFile( (u8)s_csr );
}
}
GetAndDrawRTCData( &g_rtcDraw, FALSE );
}
// TWL<57>ݒ<EFBFBD><DD92>f<EFBFBD>[<5B>^<5E>̃<EFBFBD><CC83>[<5B>h
static void ReadTWLSettings( void )
{
s_isReadTSD = TSD_ReadSettings();
if( s_isReadTSD ) {
OS_TPrintf( "TSD read succeeded.\n" );
}else {
OS_TPrintf( "TSD read failed.\n" );
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD>R<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD><EFBFBD><EFBFBD>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD>l<EFBFBD>ɍ<EFBFBD><C98D><EFBFBD>ďC<C48F><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>B
static void ModifyLanguage( u8 region )
{
u32 langBitmap = s_langBitmapList[ region ];
u8 nowLanguage = TSD_GetLanguage();
// TSD<53><44><EFBFBD>ǂݍ<C782><DD8D>߂Ă<DF82><C482>Ȃ<EFBFBD><C882>Ȃ<EFBFBD><C882>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>^<5E>[<5B><>
if( !s_isReadTSD ) {
return;
}
if( langBitmap & ( 0x0001 << nowLanguage ) ) {
OS_TPrintf( "Language no change.\n" );
}else {
int i;
for( i = 0; i < TWL_LANG_CODE_MAX; i++ ) {
if( langBitmap & ( 0x0001 << i ) ) {
break;
}
}
TSD_SetLanguage( (TWLLangCode)i );
TSD_SetFlagCountry( FALSE ); // <20><><EFBFBD>‚<EFBFBD><C282>łɍ<C582><C98D>R<EFBFBD>[<5B>h<EFBFBD><68><EFBFBD>N<EFBFBD><4E><EFBFBD>A<EFBFBD><41><EFBFBD>Ă<EFBFBD><C482><EFBFBD><EFBFBD>B
TSD_SetCountry( TWL_COUNTRY_UNDEFINED );
TSD_WriteSettings();
OS_TPrintf( "Language Change \"%s\" -> \"%s\"\n",
strLanguage[ nowLanguage ], strLanguage[ TSD_GetLanguage() ] );
}
}
// <20><EFBFBD><E996A7><EFBFBD>̃<EFBFBD><CC83>[<5B>h
static void ReadPrivateKey( void )
{
BOOL result = FALSE;
u32 keyLength;
FSFile file;
OSTick start = OS_GetTick();
FS_InitFile( &file );
if( !FS_OpenFileEx( &file, "rom:key/privKeyHWInfo.der", FS_FILEMODE_R ) ) {
OS_TPrintf( "PrivateKey read failed.\n" );
}else {
keyLength = FS_GetFileLength( &file );
if( keyLength > 0 ) {
s_pPrivKeyBuffer = Alloc( keyLength );
if( FS_ReadFile( &file, s_pPrivKeyBuffer, (s32)keyLength ) == keyLength ) {
OS_TPrintf( "PrivateKey read succeeded.\n" );
result = TRUE;
}else {
OS_TPrintf( "PrivateKey read failed.\n" );
}
}
FS_CloseFile( &file );
}
if( !result && s_pPrivKeyBuffer ) {
Free( s_pPrivKeyBuffer );
s_pPrivKeyBuffer = NULL;
}
OS_TPrintf( "PrivKey read time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - start ) );
if( s_pPrivKeyBuffer ) {
// <20><EFBFBD><E996A7><EFBFBD><EFBFBD><EFBFBD>L<EFBFBD><4C><EFBFBD>Ȃ<EFBFBD><C882>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃A<CC83>N<EFBFBD>Z<EFBFBD>X
s_pReadSecureInfoFunc = THW_ReadSecureInfo;
}else {
// <20><EFBFBD><E996A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD>Ȃ<EFBFBD><C882>̃A<CC83>N<EFBFBD>Z<EFBFBD>X
s_pReadSecureInfoFunc = THW_ReadSecureInfo_NoCheck;
PutStringUTF16( 14 * 8, 0 * 8, TXT_COLOR_RED, (const u16 *)L"[No Signature MODE]" );
}
}
// HW<48><57><EFBFBD><EFBFBD><EFBFBD>S<EFBFBD>̂̃<CC82><CC83>[<5B>h
static void ReadHWInfoFile( void )
{
TSFReadResult retval;
OSTick start = OS_GetTick();
retval = THW_ReadNormalInfo();
if( retval == TSF_READ_RESULT_SUCCEEDED ) {
OS_TPrintf( "HW Normal Info read succeeded.\n" );
}else {
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 = s_pReadSecureInfoFunc();
if( retval == TSF_READ_RESULT_SUCCEEDED ) {
OS_TPrintf( "HW Secure Info read succeeded.\n" );
}else {
OS_TPrintf( "HW Secure Info read failed.\n" );
}
OS_TPrintf( "HW Secure Info read time = %dms\n", OS_TicksToMilliSeconds( OS_GetTick() - start ) );
}
// HW<48><57><EFBFBD><EFBFBD><EFBFBD>S<EFBFBD>̂̃<CC82><CC83>C<EFBFBD>g
static void WriteHWInfoFile( u8 region )
{
static const u16 *pMsgNormalWriting = (const u16 *)L"Writing Normal File...";
static const u16 *pMsgSecureWriting = (const u16 *)L"Writing Secure File...";
static const u16 *pMsgSucceeded = (const u16 *)L"Succeeded!";
static const u16 *pMsgFailed = (const u16 *)L"Failed!";
// <20>m<EFBFBD>[<5B>}<7D><><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>̃<EFBFBD><CC83>C<EFBFBD>g
(void)PutStringUTF16( MSG_X * 8, MSG_Y * 8, TXT_COLOR_BLACK, pMsgNormalWriting );
if( WriteHWNormalInfoFile() ) {
(void)PutStringUTF16( ( MSG_X + 18 ) * 8, MSG_Y * 8, TXT_COLOR_BLUE, pMsgSucceeded );
}else {
(void)PutStringUTF16( ( MSG_X + 18 ) * 8, MSG_Y * 8, TXT_COLOR_RED, pMsgFailed );
}
// <20>Z<EFBFBD>L<EFBFBD><4C><EFBFBD>A<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>̃<EFBFBD><CC83>C<EFBFBD>g
(void)PutStringUTF16( MSG_X * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_BLACK, pMsgSecureWriting );
if( WriteHWSecureInfoFile( region ) ) {
(void)PutStringUTF16( ( MSG_X + 18 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_BLUE, pMsgSucceeded );
}else {
(void)PutStringUTF16( ( MSG_X + 18 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_RED, pMsgFailed );
}
ModifyLanguage( region );
// <20><><EFBFBD>b<EFBFBD>Z<EFBFBD>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԕ\<5C><><EFBFBD><EFBFBD><EFBFBD>ď<EFBFBD><C48F><EFBFBD>
DispMessage( 0, 0, TXT_COLOR_NULL, NULL );
NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_WHITE,
MSG_X * 8 , MSG_Y * 8, ( 32 - MSG_X ) * 8, ( MSG_Y + 4 ) * 8 );
PrintfSJISSub( 2 * 8, 18 * 8, TXT_COLOR_WHITE, "Region = %s", strRegion[ s_region_old ] );
PrintfSJISSub( 2 * 8, 18 * 8, TXT_COLOR_BLACK, "Region = %s", strRegion[ THW_GetRegion() ] );
s_region_old = THW_GetRegion();
}
// HW<48>m<EFBFBD>[<5B>}<7D><>Info<66>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>̃<EFBFBD><CC83>C<EFBFBD>g
static BOOL WriteHWNormalInfoFile( void )
{
BOOL isWrite = TRUE;
TSFReadResult result;
result = THW_ReadNormalInfo();
if( result != TSF_READ_RESULT_SUCCEEDED ) {
if( !THW_RecoveryNormalInfo( result ) ) {
OS_TPrintf( "HW Normal Info Recovery failed.\n" );
isWrite = FALSE;
}
}
if( isWrite &&
!THW_WriteNormalInfo() ) {
OS_TPrintf( "HW Normal Info Write failed.\n" );
}
return isWrite;
}
// HW<48>Z<EFBFBD>L<EFBFBD><4C><EFBFBD>AInfo<66>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>̃<EFBFBD><CC83>C<EFBFBD>g
static BOOL WriteHWSecureInfoFile( u8 region )
{
BOOL isWrite = TRUE;
TSFReadResult result;
// <20>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>̃<EFBFBD><CC83>[<5B>h
result = s_pReadSecureInfoFunc();
// <20><><EFBFBD>[<5B>h<EFBFBD>Ɏ<EFBFBD><C98E>s<EFBFBD><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>o<EFBFBD><6F>
if( result != TSF_READ_RESULT_SUCCEEDED ) {
if( !THW_RecoverySecureInfo( result ) ) {
OS_TPrintf( "HW Secure Info Recovery failed.\n" );
isWrite = FALSE;
}
}
// <20><><EFBFBD>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD>̃Z<CC83>b<EFBFBD>g
THW_SetRegion( region );
// <20>Ή<EFBFBD><CE89><EFBFBD><EFBFBD><EFBFBD><EFBFBD>r<EFBFBD>b<EFBFBD>g<EFBFBD>}<7D>b<EFBFBD>v<EFBFBD>̃Z<CC83>b<EFBFBD>g
THW_SetValidLanguageBitmap( s_langBitmapList[ region ] );
// [TODO:]<5D>ʎY<CA8E>H<EFBFBD><48><EFBFBD>łȂ<C582><C882>ƃV<C683><56><EFBFBD>A<EFBFBD><41>No.<2E>͗p<CD97>ӂł<D382><C582>Ȃ<EFBFBD><C882>̂ŁA<C581><41><EFBFBD><EFBFBD><EFBFBD>ł<EFBFBD>MAC<41>A<EFBFBD>h<EFBFBD><68><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD>ƂɓK<C993><4B><EFBFBD>Ȓl<C892><6C><EFBFBD>Z<EFBFBD>b<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>B
// <20>V<EFBFBD><56><EFBFBD>A<EFBFBD><41>No.<2E>̃Z<CC83>b<EFBFBD>g
{
u8 buffer[ 12 ] = "SERIAL"; // <20>K<EFBFBD><4B><EFBFBD>ȕ<EFBFBD><C895><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>MAC<41>A<EFBFBD>h<EFBFBD><68><EFBFBD>X<EFBFBD>ƌ<EFBFBD><C68C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SHA1<41><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD><41>SerialNo<4E>Ƃ<EFBFBD><C682><EFBFBD><EFBFBD>B
u8 serialNo[ SVC_SHA1_DIGEST_SIZE ];
int i;
int len = ( THW_GetRegion() == TWL_REGION_AMERICA ) ?
TWL_HWINFO_SERIALNO_LEN_AMERICA : TWL_HWINFO_SERIALNO_LEN_OTHERS;
OS_GetMacAddress( buffer + 6 );
SVC_CalcSHA1( serialNo, buffer, sizeof(buffer) );
for( i = 3; i < SVC_SHA1_DIGEST_SIZE; i++ ) {
serialNo[ i ] = (u8)( ( serialNo[ i ] % 10 ) + 0x30 );
}
MI_CpuCopy8( "SRN", serialNo, 3 );
MI_CpuClear8( &serialNo[ len ], sizeof(serialNo) - len );
OS_TPrintf( "serialNo : %s\n", serialNo );
THW_SetSerialNo( serialNo );
}
// <20><><EFBFBD>C<EFBFBD>g
if( isWrite &&
!THW_WriteSecureInfo( s_pPrivKeyBuffer ) ) {
isWrite = FALSE;
OS_TPrintf( "HW Secure Info Write failed.\n" );
}
return isWrite;
}
// HWInfo<66>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>̍폜
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 *pMsgSucceeded = (const u16 *)L"Succeeded!";
static const u16 *pMsgFailed = (const u16 *)L"Failed!";
// <20>m<EFBFBD>[<5B>}<7D><><EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43>
(void)PutStringUTF16( MSG_X * 8, MSG_Y * 8, TXT_COLOR_BLACK, pMsgNormalDeleting );
if( FS_DeleteFile( (char *)TWL_HWINFO_NORMAL_PATH ) ) {
OS_TPrintf( "%s delete succeeded.\n", (char *)TWL_HWINFO_NORMAL_PATH );
(void)PutStringUTF16( ( MSG_X + 19 ) * 8, MSG_Y * 8, TXT_COLOR_BLUE, pMsgSucceeded );
}else {
OS_TPrintf( "%s delete failed.\n", (char *)TWL_HWINFO_NORMAL_PATH );
(void)PutStringUTF16( ( MSG_X + 19 ) * 8, MSG_Y * 8, TXT_COLOR_RED, pMsgFailed );
}
// <20>Z<EFBFBD>L<EFBFBD><4C><EFBFBD>A<EFBFBD>t<EFBFBD>@<40>C<EFBFBD><43>
(void)PutStringUTF16( MSG_X * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_BLACK, pMsgSecureDeleting );
if( FS_DeleteFile( (char *)TWL_HWINFO_SECURE_PATH ) ) {
OS_TPrintf( "%s delete succeeded.\n", (char *)TWL_HWINFO_SECURE_PATH );
(void)PutStringUTF16( ( MSG_X + 19 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_BLUE, pMsgSucceeded );
}else {
OS_TPrintf( "%s delete failed.\n", (char *)TWL_HWINFO_SECURE_PATH );
(void)PutStringUTF16( ( MSG_X + 19 ) * 8, ( MSG_Y + 2 ) * 8, TXT_COLOR_RED, pMsgFailed );
}
DispMessage( 0, 0, TXT_COLOR_NULL, NULL );
NNS_G2dCharCanvasClearArea( &gCanvas, TXT_COLOR_WHITE,
MSG_X * 8 , MSG_Y * 8, ( 32 - MSG_X ) * 8, ( MSG_Y + 4 ) * 8 );
}
// HWInfo<66>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>̃x<CC83><78><EFBFBD>t<EFBFBD>@<40>C
static void VerifyHWInfo( void )
{
if( VerifyData( (const u8 *)THW_GetNormalInfo(), (const u8 *)THW_GetDefaultNormalInfo(), sizeof(TWLHWNormalInfo) ) ) {
OS_TPrintf( "HW normal Info verify succeeded.\n" );
}else {
OS_TPrintf( "HW normal Info verify failed.\n" );
}
if( VerifyData( (const u8 *)THW_GetSecureInfo(), (const u8 *)THW_GetDefaultSecureInfo(), sizeof(TWLHWSecureInfo) ) ) {
OS_TPrintf( "HW secure Info verify succeeded.\n" );
}else {
OS_TPrintf( "HW secure Info verify failed.\n" );
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̃f<CC83>[<5B>^<5E>x<EFBFBD><78><EFBFBD>t<EFBFBD>@<40>C
static BOOL VerifyData( const u8 *pTgt, const u8 *pOrg, u32 len )
{
while( len-- ) {
if( *pTgt++ != *pOrg++ ) {
return FALSE;
}
}
return TRUE;
}
// <20><><EFBFBD>b<EFBFBD>Z<EFBFBD>[<5B>W<EFBFBD>\<5C><>
static void DispMessage( int x, int y, u16 color, const u16 *pMsg )
{
OSTick start = OS_GetTick();
// <20><><EFBFBD>b<EFBFBD>Z<EFBFBD>[<5B>W<EFBFBD>\<5C><>
if( pMsg ) {
(void)PutStringUTF16( x, y, color, pMsg );
}
// <20>E<EFBFBD>F<EFBFBD>C<EFBFBD>g
while( OS_TicksToSeconds( OS_GetTick() - start ) < 2 ) {
OS_SpinWait( 0x1000 );
}
// <20><><EFBFBD>b<EFBFBD>Z<EFBFBD>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD>
if( pMsg ) {
(void)PutStringUTF16( x, y, TXT_COLOR_WHITE, pMsg );
}
}