AES鍵のファームによる変更 (NAND暗号化鍵も変更されます!)

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@988 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yutaka 2008-03-27 12:05:01 +00:00
parent 926b0278d0
commit 2521a7e48c
6 changed files with 52 additions and 1 deletions

View File

@ -15,6 +15,7 @@
$Author$ $Author$
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
#include <firm/os.h>
#include <firm/aes.h> #include <firm/aes.h>
#include <firm/pxi.h> #include <firm/pxi.h>
@ -23,6 +24,25 @@
#define AES_IDS_ID0_D(c) (((unsigned long)c[3] << 0) | ((unsigned long)c[2] << 8) | ((unsigned long)c[1] << 16) | ((unsigned long)c[0] << 24)) #define AES_IDS_ID0_D(c) (((unsigned long)c[3] << 0) | ((unsigned long)c[2] << 8) | ((unsigned long)c[1] << 16) | ((unsigned long)c[0] << 24))
/*---------------------------------------------------------------------------*
Name: AESi_PreInitKeys
Description: reset IDs preset by bootrom.
you SHOULD NOT touch any ID registers after this call.
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void AESi_PreInitKeys( void )
{
AES_WaitKey();
reg_AES_AES_ID_B2 = reg_OS_CHIP_ID1 ^ *(const u32*)&OSi_GetFromFirmAddr()->aes_key[2][0];
reg_AES_AES_ID_D1 = reg_OS_CHIP_ID0 ^ *(const u32*)&OSi_GetFromFirmAddr()->aes_key[2][8];
reg_AES_AES_ID_D2 = reg_OS_CHIP_ID1 ^ *(const u32*)&OSi_GetFromFirmAddr()->aes_key[2][4];
}
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
Name: AESi_InitKeysForApp Name: AESi_InitKeysForApp

View File

@ -79,7 +79,8 @@ void OS_BootWithRomHeaderFromFIRM( ROM_Header* rom_header )
mem_list[i++] = stack_bottom - code_buf_end; mem_list[i++] = stack_bottom - code_buf_end;
} }
/* 一部鍵バッファのクリア (鍵管理.xls参照) */ /* 一部鍵バッファのクリア (鍵管理.xls参照) */
// 該当無し mem_list[i++] = (u32)OSi_GetFromFirmAddr()->aes_key[2];
mem_list[i++] = ACS_AES_LEN;
#endif // SDK_ARM7 #endif // SDK_ARM7
mem_list[i++] = NULL; mem_list[i++] = NULL;
// copy forward // copy forward

View File

@ -122,6 +122,15 @@ static void PreInit(void)
{ {
OS_Terminate(); OS_Terminate();
} }
/*
AES関連 (NAND暗号化の鍵変更を含む)
*/
#ifndef SDK_FINALROM
if ( !*(u8*)HW_TWL_RED_LAUNCHER_VER )
#endif
{
AESi_PreInitKeys();
}
/* /*
(1)(1) (1)(1)
*/ */

View File

@ -122,6 +122,15 @@ static void PreInit(void)
{ {
OS_Terminate(); OS_Terminate();
} }
/*
AES関連 (NAND暗号化の鍵変更を含む)
*/
#ifndef SDK_FINALROM
if ( !*(u8*)HW_TWL_RED_LAUNCHER_VER )
#endif
{
AESi_PreInitKeys();
}
/* /*
(1)(1) (1)(1)
*/ */

Binary file not shown.

View File

@ -27,6 +27,18 @@ extern "C" {
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
ŠÖ<EFBFBD>è` ŠÖ<EFBFBD>è`
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*
Name: AESi_PreInitKeys
Description: reset IDs preset by bootrom.
you SHOULD NOT touch any ID registers after this call.
Arguments: None
Returns: None
*---------------------------------------------------------------------------*/
void AESi_PreInitKeys( void );
/*---------------------------------------------------------------------------* /*---------------------------------------------------------------------------*
Name: AESi_InitKeysForApp Name: AESi_InitKeysForApp