・es-sdk-20080415_rc2への対応のため、ランチャーでSEAライブラリのAESスロットBを使用するよう変更。

・上記変更に伴い、ROM_SPECファイルで"HwAESSlotB TRUE"を指定。
・ドキュメント更新。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@1197 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yosiokat 2008-04-21 06:03:41 +00:00
parent ea7b6eaa50
commit 7525109b97
15 changed files with 139 additions and 72 deletions

View File

@ -105,6 +105,7 @@ static void InitializeCdc(void);
extern void SDK_LTDAUTOLOAD_LTDWRAM_BSS_END(void);
extern void SDK_LTDAUTOLOAD_LTDMAIN_BSS_END(void);
#endif
extern void SDK_SEA_KEY_STORE(void);
/*---------------------------------------------------------------------------*
Name: TwlSpMain
@ -180,6 +181,9 @@ TwlSpMain(void)
InitializeNwm(mainHeapHandle, mainHeapHandle); // NWM <20>‰Šú‰»
#ifndef SDK_NOCRYPTO
AES_Init(); // AES <20>‰Šú‰»
SYSMi_SetAESKeysForAccessControl( (ROM_Header *)HW_TWL_ROM_HEADER_BUF, (u8 *)SDK_SEA_KEY_STORE, NULL, NULL );
#ifdef SDK_SEA
SEA_Init();
#endif // ifdef SDK_SEA

View File

@ -25,7 +25,6 @@
#include <firm/hw/ARM7/mmap_firm.h>
#include <firm/format/from_firm.h>
#include <firm/aes/ARM7/aes_init.h>
#include <firm/os/common/boot.h>
#include "reboot.h"
#include "internal_api.h"
@ -75,33 +74,12 @@ static u32 nitro_post_clear_list[POST_CLEAR_NUM_MAX + 1] =
// const data--------------------------------------------------------
// dev_commonKeyはベタで持っていい。
static const u8 dev_commonKey[] = {
0xA1, 0x60, 0x4A, 0x6A, 0x71, 0x23, 0xB5, 0x29,
0xAE, 0x8B, 0xEC, 0x32, 0xC8, 0x16, 0xFC, 0xAA
};
static const u8 dev_seedES[] = {
0x2D, 0xD4, 0x03, 0x98, 0xA7, 0x6B, 0x03, 0x28,
0xCE, 0x61, 0x04, 0xBB, 0x0A, 0xBB, 0x03, 0x5B,
};
static const u8 dev_seedNAM[] = {
0x4D, 0x04, 0xA4, 0x7F, 0xE3, 0x02, 0x30, 0x2E,
0x2A, 0x07, 0x06, 0xE6, 0xD9, 0x06, 0x47, 0x76,
};
static const u8 dev_seedSlotC[] = {
0x3B, 0x06, 0x86, 0x57, 0x33, 0x04, 0x88, 0x11,
0x49, 0x04, 0x6B, 0x33, 0x12, 0x02, 0xAC, 0xF3,
};
void BOOT_Init( void )
{
reg_PXI_MAINPINTF = 0x0000;
}
BOOL BOOT_WaitStart( void )
{
if( (reg_PXI_MAINPINTF & 0x000f ) == 0x000f ) {
@ -161,38 +139,7 @@ BOOL BOOT_WaitStart( void )
MI_CpuClearFast( (void *)HW_LAUNCHER_DELIVER_PARAM_BUF, HW_LAUNCHER_DELIVER_PARAM_BUF_SIZE );
if( ! isNtrMode ) {
if( th->s.titleID_Hi & TITLE_ID_HI_SECURE_FLAG_MASK ) {
// commonClientKey
if( th->s.access_control.common_client_key ) {
void *pCommonKey = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ?
OSi_GetFromFirmAddr()->aes_key[ 0 ] : (void *)dev_commonKey;
MI_CpuCopy8( pCommonKey, (void *)HW_LAUNCHER_DELIVER_PARAM_BUF, AES_BLOCK_SIZE );
}
// commonClientKeyForDebugger
else if( th->s.access_control.common_client_key_for_debugger_sysmenu ) {
MI_CpuCopy8( OSi_GetFromFirmAddr()->aes_key[ 1 ], (void *)HW_LAUNCHER_DELIVER_PARAM_BUF, AES_BLOCK_SIZE );
}
// HW AES Slot B
if( th->s.access_control.hw_aes_slot_B ) {
void *pSeedES = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ?
&( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0 ] ) : (void *)dev_seedES;
MI_CpuCopy8( pSeedES, (void *)( HW_LAUNCHER_DELIVER_PARAM_BUF + 0x10 ), AES_BLOCK_SIZE );
isClearSlotB = FALSE;
// AESスロットのデフォルト値セットは不要
}
// HW AES Slot C
if( th->s.access_control.hw_aes_slot_C ) {
void *pSeedNAM = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ?
&( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0x10 ] ) : (void *)dev_seedNAM;
void *pSeedSlotC = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ?
&( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0x20 ] ) : (void *)dev_seedSlotC;
MI_CpuCopy8( pSeedNAM, (void *)( HW_LAUNCHER_DELIVER_PARAM_BUF + 0x20 ), AES_BLOCK_SIZE );
isClearSlotC = FALSE;
// AESスロットのデフォルト値セット
AES_Lock();
AES_SetKeySeedC( pSeedSlotC );
AES_Unlock();
}
SYSMi_SetAESKeysForAccessControl( th, (u8 *)HW_LAUNCHER_DELIVER_PARAM_BUF, &isClearSlotB, &isClearSlotC );
}
}
// ブートするアプリに応じて、AESキースロットのクリアを行う。

View File

@ -24,12 +24,14 @@ TARGET_PLATFORM = TWL
TWL_ARCHGEN = LIMITED
TWL_PROC = ARM7
SRCDIR = ../common/src
SRCS = status.c \
SRCS_COMMON = status.c \
pxi.c \
mountInfo.c \
decodeAES.c
SRCS = setAESKey.c \
$(addprefix ../common/src/, $(SRCS_COMMON))
TARGET_LIB = libsysmenu_sp$(TWL_LIBSUFFIX).a
ifneq ($(DHT_TEST),)

View File

@ -0,0 +1,102 @@
/*---------------------------------------------------------------------------*
Project: TwlIPL
File: setAESKey.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 <twl/aes/ARM7/lo.h>
#include <firm/aes/ARM7/aes_init.h>
#include <firm/hw/ARM7/mmap_firm.h>
#include <firm/format/from_firm.h>
#include <firm/os/common/boot.h>
#include <sysmenu.h>
#include "internal_api.h"
// define data-----------------------------------------------------------------
// extern data-----------------------------------------------------------------
// function's prototype-------------------------------------------------------
// global variable-------------------------------------------------------------
// static variable-------------------------------------------------------------
// const data------------------------------------------------------------------
// dev_commonKeyはベタで持っていい。
static const u8 dev_commonKey[] = {
0xA1, 0x60, 0x4A, 0x6A, 0x71, 0x23, 0xB5, 0x29,
0xAE, 0x8B, 0xEC, 0x32, 0xC8, 0x16, 0xFC, 0xAA
};
static const u8 dev_seedES[] = {
0x2D, 0xD4, 0x03, 0x98, 0xA7, 0x6B, 0x03, 0x28,
0xCE, 0x61, 0x04, 0xBB, 0x0A, 0xBB, 0x03, 0x5B,
};
static const u8 dev_seedNAM[] = {
0x4D, 0x04, 0xA4, 0x7F, 0xE3, 0x02, 0x30, 0x2E,
0x2A, 0x07, 0x06, 0xE6, 0xD9, 0x06, 0x47, 0x76,
};
static const u8 dev_seedSlotC[] = {
0x3B, 0x06, 0x86, 0x57, 0x33, 0x04, 0x88, 0x11,
0x49, 0x04, 0x6B, 0x33, 0x12, 0x02, 0xAC, 0xF3,
};
// ============================================================================
//
// AES鍵スロット設定
//
// ============================================================================
void SYSMi_SetAESKeysForAccessControl( ROM_Header *pROMH, u8 *pDst, BOOL *pIsClearSlotB, BOOL *pIsClearSlotC )
{
// commonClientKey
if( pROMH->s.access_control.common_client_key ) {
void *pCommonKey = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ?
OSi_GetFromFirmAddr()->aes_key[ 0 ] : (void *)dev_commonKey;
MI_CpuCopy8( pCommonKey, pDst, AES_BLOCK_SIZE );
}
// commonClientKeyForDebugger
else if( pROMH->s.access_control.common_client_key_for_debugger_sysmenu ) {
MI_CpuCopy8( OSi_GetFromFirmAddr()->aes_key[ 1 ], (void *)HW_LAUNCHER_DELIVER_PARAM_BUF, AES_BLOCK_SIZE );
}
// HW AES Slot B
if( pROMH->s.access_control.hw_aes_slot_B ) {
void *pSeedES = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ?
&( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0 ] ) : (void *)dev_seedES;
MI_CpuCopy8( pSeedES, pDst + 0x10, AES_BLOCK_SIZE );
if( pIsClearSlotB ) {
*pIsClearSlotB = FALSE;
}
// AESスロットのデフォルト値セットは不要
}
// HW AES Slot C
if( pROMH->s.access_control.hw_aes_slot_C ) {
void *pSeedNAM = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ?
&( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0x10 ] ) : (void *)dev_seedNAM;
void *pSeedSlotC = ( SCFG_GetBondingOption() == SCFG_OP_PRODUCT ) ?
&( OSi_GetFromFirmAddr()->rsa_pubkey[ 3 ][ 0x20 ] ) : (void *)dev_seedSlotC;
MI_CpuCopy8( pSeedNAM, pDst + 0x20, AES_BLOCK_SIZE );
if( pIsClearSlotC ) {
*pIsClearSlotC = FALSE;
}
// AESスロットのデフォルト値セット
AES_Lock();
AES_SetKeySeedC( pSeedSlotC );
AES_Unlock();
}
}

View File

@ -42,7 +42,7 @@ extern "C" {
// BootSRLPath受け渡し用
void SYSMi_SetBootSRLPathToWork2( TitleProperty *pBootTitle );
#else
#else // !SDK_ARM9
// ランチャー用
void SYSMi_SetLauncherMountInfo( void );
@ -50,7 +50,8 @@ void SYSMi_SetLauncherMountInfo( void );
// 起動アプリ用
void SYSMi_SetBootAppMountInfo( TitleProperty *pBootTitle );
#endif
#endif // SDK_ARM9
#ifdef SDK_ARM9
//-------------------------------------------------------
@ -83,7 +84,16 @@ BOOL SYSMi_ReadBanner_NAND( NAMTitleId titleID, TWLBannerFile *pDst );
void SYSMi_EnableHotSW( BOOL enable );
#endif
#endif // SDK_ARM9
#ifdef SDK_ARM7
//-------------------------------------------------------
// AESŒ®<C592>Ýè
//-------------------------------------------------------
void SYSMi_SetAESKeysForAccessControl( ROM_Header *pROMH, u8 *pDst, BOOL *pIsClearSlotB, BOOL *pIsClearSlotC );
#endif // SDK_ARM7
//=======================================================

View File

@ -29,6 +29,8 @@ SUBDIRS = \
#----------------------------------------------------------------------------
DISABLE_DEBUG = TRUE
DO_NOT_SHOW_LAUNCHER = FALSE
ENABLE_WDS_SCAN = FALSE
TARGET_FIRM = SYSTEMMENU
TARGET_PLATFORM = TWL
@ -90,6 +92,10 @@ ifdef DO_NOT_SHOW_LAUNCHER
MACRO_FLAGS += -DDO_NOT_SHOW_LAUNCHER
endif
ifdef ENABLE_WDS_SCAN
MACRO_FLAGS += -DENABLE_WDS_SCAN
endif
ifneq ($(DHT_TEST),)
MACRO_FLAGS += -DDHT_TEST
MAKEROM_FLAGS += -DDS_HASH_TABLE_FILE=DSHashTable.bin

View File

@ -134,6 +134,11 @@ Property
#
LockSCFG FALSE
#
# HwAESSlotB: launcher deliver HW AES slot B setting [TRUE/FALSE]
#
HwAESSlotB TRUE
#
# NANDAccess: nand access control [TRUE/FALSE]
#

View File

@ -545,23 +545,14 @@ BOOL PollingInstallWlanFirmware( BOOL isStartScanWDS )
WLANFirmResult result;
if( GetWlanFirmwareInstallResult( &result ) ) {
if( result == WLANFIRM_RESULT_SUCCESS ) {
#if 0
// ロード成功
BOOL enable;
if( LCFG_THW_IsForceDisableWireless() ) {
enable = FALSE;
}else {
enable = LCFG_TSD_IsAvailableWireless();
}
SYSMi_SetWirelessLED( enable );
#endif
OS_TPrintf( "WLFIRM load finished.\n" );
#ifdef ENABLE_WDS_SCAN
// WDSスキャンがTRUE かつ 無線フラグがONならば、引き続きWDSビーコン受信開始
if( isStartScanWDS &&
!LCFG_THW_IsForceDisableWireless() && LCFG_TSD_IsAvailableWireless() ) {
StartScanWDS();
}
#endif // ENABLE_WDS_SCAN
}else {
// ロード失敗
if( !s_isHotStartWLFirm ) {

Binary file not shown.

Binary file not shown.