mirror of
https://github.com/rvtr/ctr_eFuse.git
synced 2025-11-02 00:11:04 -04:00
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:
parent
5cba053068
commit
a349e3a00c
@ -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;
|
||||
|
||||
@ -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 );
|
||||
|
||||
Loading…
Reference in New Issue
Block a user