TODO:HSMリセットの追加

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-09-30%20-%20paladin.7z/paladin/ctr_eFuse@88 ff987cc8-cf2f-4642-8568-d52cce064691
This commit is contained in:
kubodera_yuichi 2009-12-25 00:38:49 +00:00
parent 5cba053068
commit a349e3a00c
2 changed files with 40 additions and 0 deletions

View File

@ -156,11 +156,19 @@ int hsm_initialize( void )
int ret_code = CR_GENID_SUCCESS;
// TODO: HSMリセットを入れる。
ret_code = hsm_reset_module();
if ( ret_code != CR_GENID_SUCCESS )
{
SetErrorInfo( __FUNCTION__, __LINE__ );
return ret_code;
}
// init HSM
ret_code = NFastApp_InitEx( &hsmHandle, NULL, NULL );
if ( ret_code != CR_GENID_SUCCESS )
{
SetErrorInfo( __FUNCTION__, __LINE__ );
return ret_code;
}
@ -240,6 +248,37 @@ void hsm_finalize( void )
NFastApp_Finish( hsmHandle, NULL );
} // hsm_finalize
int hsm_reset_module( void )
{
int ret_code = CR_GENID_SUCCESS;
M_Command cmd;
M_Reply reply;
memset( &cmd, 0, sizeof( cmd ) );
memset( &reply, 0, sizeof( reply ) );
cmd.cmd = Cmd_ClearUnit;
cmd.args.clearunit.module = HSM_MODULE_ID;
ret_code = NFastApp_Transsct( hsmConnection, NULL, &cmd, &reply, NULL );
if ( ret_code != CR_GENID_SUCCESS )
{
SetErrorInfo( __FUNCTION__, __LINE__ );
return ret_code;
}
ret_code = reply.status;
if ( ret_code != CR_GENID_SUCCESS )
{
SetErrorInfo( __FUNCTION__, __LINE__ );
return ret_code;
}
NFastApp_Free_Command( hsmHandle, NULL, NULL, &cmd );
NFastApp_Free_Reply( hsmHandle, NULL, NULL, &reply );
return ret_code;
} // hsm_reset_module
int hsm_generate_random( unsigned char *buf, int bytes )
{
int ret_code = CR_GENID_SUCCESS;

View File

@ -121,6 +121,7 @@ extern "C" {
// functions
int hsm_initialize( void );
void hsm_finalize( void );
int hsm_reset_module( void );
int hsm_generate_random( unsigned char *buf, int bytes );
int hsm_get_rtc( time_t *time );
int hsm_aes_encrypt( unsigned char *dst_buf, unsigned char *org_buf, int size, unsigned char bondingOption );